@font-face { font-family: "Inter"; src: url("/assets/fonts/Inter.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --border: #E4E7EC;
  --border-strong: #D0D5DD;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --primary: #2350D8;
  --primary-hover: #1C43BA;
  --primary-soft: #EEF3FF;
  --danger: #C4321F;
  --danger-soft: #FEF3F2;
  --warning-soft: #FFFAEB;
  --warning-border: #FEDF89;
  --warning-text: #93370D;
  --success: #067647;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-page: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .08);
  --topbar-h: 60px;
  --focus: 0 0 0 3px rgba(35, 80, 216, .2);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
main { outline: none; }
h1, h2, h3, p { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); background: rgba(255,255,255,.92);
          backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { height: 100%; max-width: 1440px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); flex: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--primary); position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; left: 7px; height: 2.4px; border-radius: 2px; background: #fff; }
.brand-mark::before { top: 8px; width: 12px; box-shadow: 0 5px 0 #fff; }
.brand-mark::after { top: 18px; width: 7px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-name span { font-weight: 500; color: var(--text-2); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.steps { display: flex; align-items: center; gap: 6px; margin: 0 auto; font-size: 13.5px; }
.step { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); white-space: nowrap; text-decoration: none; padding: 4px 6px; border-radius: 6px; }
a.step:hover { background: var(--surface-2); color: var(--text); }
.step-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600;
            border: 1.5px solid var(--border-strong); color: var(--text-3); background: var(--surface); }
.step.is-current { color: var(--text); font-weight: 600; }
.step.is-current .step-num { border-color: var(--primary); background: var(--primary); color: #fff; }
.step.is-done .step-num { border-color: var(--primary); color: var(--primary); }
.step-num .icon { width: 13px; height: 13px; stroke-width: 3; }
.step-sep { width: 28px; height: 1.5px; background: var(--border-strong); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: var(--radius-sm);
       border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 550;
       cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: rgba(16,24,40,.05); color: var(--text); }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 9px; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-dashed { border-style: dashed; box-shadow: none; color: var(--text-2); width: 100%; height: 42px; }
.btn-dashed:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 6px;
            color: var(--text-3); cursor: pointer; }
.icon-btn:hover { background: rgba(16,24,40,.06); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.icon { width: 18px; height: 18px; flex: none; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Home ---------- */
.home { max-width: 1080px; margin: 0 auto; padding: 72px 24px 96px; }
.hero { text-align: center; max-width: 680px; margin: 0 auto 48px; }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 600; color: var(--primary); background: var(--primary-soft); padding: 4px 10px; border-radius: 999px; margin-bottom: 18px; }
.hero h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.1; letter-spacing: -.025em; font-weight: 700; }
.hero p { margin-top: 16px; font-size: 18px; color: var(--text-2); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.doc-card { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 24px; border-radius: 14px; background: var(--surface);
            border: 1px solid var(--border); box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.doc-card:hover { border-color: #B6C6F5; box-shadow: 0 6px 20px rgba(35,80,216,.10); transform: translateY(-1px); }
a.doc-card:focus-visible { outline: none; box-shadow: var(--focus); }
.doc-card.is-soon { opacity: .7; }
.doc-thumb { height: 150px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; }
.doc-thumb .sheet { width: 96px; height: 128px; background: #fff; border-radius: 3px; box-shadow: var(--shadow); padding: 12px 10px; display: flex; flex-direction: column; gap: 5px; }
.sheet i { display: block; height: 4px; border-radius: 2px; background: #E4E7EC; }
.sheet i.h { height: 7px; width: 60%; background: #344054; }
.sheet i.a { width: 40%; background: var(--primary); opacity: .7; }
.sheet i.s { width: 30%; height: 3px; background: var(--primary); opacity: .5; margin-top: 4px; }
.sheet i.m { width: 85%; } .sheet i.n { width: 70%; }
.sheet i.g { height: 0; margin: 10px 0 6px; }
.doc-card h2 { font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.doc-card p { color: var(--text-2); font-size: 14.5px; }
.doc-card .cta { margin-top: auto; font-size: 14px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 6px; }
.badge { position: absolute; top: 16px; right: 16px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; }
.how { margin-top: 64px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.how-item { display: flex; gap: 12px; }
.how-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 650; font-size: 13px; display: grid; place-items: center; }
.how-item h3 { font-size: 15px; font-weight: 600; }
.how-item p { font-size: 14px; color: var(--text-3); margin-top: 2px; }

/* ---------- Editor ---------- */
.editor { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; min-height: calc(100vh - var(--topbar-h)); }
.editor-form { padding: 32px 40px 120px; border-right: 1px solid var(--border); background: var(--bg); }
.form-inner { max-width: 680px; margin: 0 auto; }
.form-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.form-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.form-head p { color: var(--text-3); font-size: 14px; margin-top: 2px; }
.form-head-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.save-state { font-size: 12.5px; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
.save-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #12B76A; }
.save-state[data-state="pending"]::before, .save-state[data-state="saving"]::before { background: #F79009; }
.save-state[data-state="error"] { color: var(--danger); }
.save-state[data-state="error"]::before { background: var(--danger); }
.doc-type { font-size: 12.5px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; }
.title-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.doc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-head-text { min-width: 0; flex: 1; }
.form-hint { font-size: 13.5px; color: var(--text-3); margin: -12px 0 18px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.card-head { padding: 18px 20px 0; }
.card-head h2 { font-size: 16px; font-weight: 650; letter-spacing: -.005em; display: flex; align-items: center; gap: 8px; }
.card-head .count { font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; }
.card-head p { font-size: 13.5px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 16px 20px 20px; }

.fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; grid-column: span 4; }
.field.w-half { grid-column: span 2; }
.field.w-quarter { grid-column: span 1; }
.field label, .field .label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.field .req { color: var(--danger); margin-left: 2px; }
.field .help { font-size: 12.5px; color: var(--text-3); }
.input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
         box-shadow: var(--shadow-sm); font-size: 14.5px; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 80px; padding: 9px 12px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input::placeholder { color: #98A2B3; }
.input:hover { border-color: #B4BBC6; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.input.is-invalid { border-color: #F04438; }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); cursor: pointer; }

.items { display: flex; flex-direction: column; gap: 12px; }
.item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.item-head { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 14px; border-bottom: 1px solid transparent; }
.item.is-open .item-head { border-bottom-color: var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.item-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 0; cursor: pointer; text-align: left; }
.item-toggle:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.item-toggle .chev { transition: transform .15s; color: var(--text-3); }
.item.is-open .item-toggle .chev { transform: rotate(90deg); }
.item-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-title.is-empty { color: var(--text-3); font-weight: 500; }
.item-body { padding: 16px 14px 16px; }
.items + .btn-dashed, .compact-list + .btn-dashed { margin-top: 12px; }
.empty-note { font-size: 13.5px; color: var(--text-3); padding: 2px 0 0; }

.compact-list { display: flex; flex-direction: column; gap: 8px; }
.compact-row { display: flex; gap: 8px; align-items: flex-end; }
.compact-row .field { grid-column: auto; flex: 1 1 auto; }
.compact-row .field.w-fixed { flex: 0 0 210px; }
.compact-row .row-actions { display: flex; gap: 0; padding-bottom: 4px; }
.compact-list .compact-row:not(:first-child) .field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.form-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* Live preview */
.editor-preview { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); background: #EBEDF1; display: flex; flex-direction: column; }
.preview-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; font-size: 13px; color: var(--text-3); gap: 12px; }
.preview-bar strong { color: var(--text-2); font-weight: 600; }
.preview-status { display: inline-flex; align-items: center; gap: 6px; }
.preview-scroll { flex: 1; overflow: auto; padding: 4px 28px 40px; }
.preview-stage { margin: 0 auto; position: relative; }
.preview-stage iframe { position: absolute; top: 0; left: 0; border: 0; background: #fff; transform-origin: 0 0; box-shadow: var(--shadow-page); border-radius: 2px; }
.preview-note { text-align: center; font-size: 12.5px; color: var(--text-3); margin-top: 14px; }

.mobile-tabs { display: none; }

.field.w-quarter-3 { grid-column: span 3; }
.input-number { text-align: right; }
.compact-row .field.w-small { flex: 0 0 80px; }
.compact-row .field.w-medium { flex: 0 0 130px; }

/* Style picker */
.style-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.style-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 6px 8px; border-radius: 10px;
              border: 1.5px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 13px; font-weight: 550;
              color: var(--text-2); transition: border-color .12s, background .12s; }
.style-tile:hover { border-color: #B6C6F5; background: var(--surface); }
.style-tile:focus-visible { outline: none; box-shadow: var(--focus); }
.style-tile[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.mini { width: 58px; height: 76px; background: #fff; border-radius: 3px; box-shadow: 0 1px 3px rgba(16,24,40,.15);
        padding: 7px 6px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.mini i { display: block; height: 3px; border-radius: 2px; background: #E4E7EC; }
.mini .mini-head { display: flex; flex-direction: column; gap: 3px; padding-bottom: 4px; margin-bottom: 2px; }
.mini .mini-name { width: 70%; height: 5px; background: #344054; }
.mini .mini-sub { width: 45%; background: var(--a); opacity: .8; }
.mini .mini-title { width: 40%; height: 3px; background: var(--a); margin-top: 3px; }
.mini .mini-line.short { width: 70%; }
.mini-rule .mini-head { border-bottom: 1.5px solid var(--a); }
.mini-band .mini-head { background: var(--t); border-left: 2.5px solid var(--a); padding: 4px; margin: -2px -1px 2px; }
.mini-centered .mini-head { align-items: center; border-bottom: 1px solid #E4E7EC; }
.mini-centered .mini-title { align-self: center; }
.mini-plain .mini-name { background: #98A2B3; height: 4px; }
.mini-plain .mini-sub, .mini-plain .mini-title { background: #D0D5DD; }
.mini-dark .mini-head { background: var(--d); padding: 4px; margin: -2px -1px 2px; }
.mini-dark .mini-name { background: #fff; }
.grid-title { text-align: center; font-size: 15px; font-weight: 600; color: var(--text-3); margin: 0 0 18px; }
.doc-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.sheet i.c { width: 50%; margin: 0 auto; height: 5px; background: var(--primary); opacity: .6; }
.sheet i.tb { height: 6px; background: #DDE6FF; }

/* ---------- Review ---------- */
.review { max-width: 1200px; margin: 0 auto; padding: 32px 24px 80px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.page-img { width: 100%; max-width: 760px; background: #fff; box-shadow: var(--shadow-page); border-radius: 2px; display: block; }
.page-label { font-size: 12.5px; color: var(--text-3); margin-top: -14px; }
.pages-loading { width: 100%; max-width: 760px; aspect-ratio: 210 / 297; background: #fff; box-shadow: var(--shadow-page); display: grid; place-items: center; color: var(--text-3); gap: 10px; align-content: center; justify-items: center; font-size: 14px; }
.review-panel { position: sticky; top: calc(var(--topbar-h) + 24px); }
.review-panel .card-body { display: flex; flex-direction: column; gap: 10px; }
.review-panel h1 { font-size: 20px; font-weight: 700; letter-spacing: -.015em; }
.review-panel .meta { font-size: 13.5px; color: var(--text-3); margin-bottom: 8px; }
.notice { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; }
.notice-warning { background: var(--warning-soft); border: 1px solid var(--warning-border); color: var(--warning-text); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice a { color: inherit; font-weight: 600; }
.divider { height: 1px; background: var(--border); margin: 6px 0; }
.success-line { display: inline-flex; gap: 6px; align-items: center; color: var(--success); font-size: 13.5px; font-weight: 550; }

/* ---------- Account ---------- */
.topbar-view, .topbar-account { display: flex; align-items: center; gap: 8px; }
.lang-switch { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.lang-switch button { border: 0; background: transparent; font-size: 12px; font-weight: 650; letter-spacing: .03em; color: var(--text-3);
                      padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.lang-switch button:focus-visible { outline: none; box-shadow: var(--focus); }
.account { position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--primary-soft); color: var(--primary);
          font-weight: 700; font-size: 13px; cursor: pointer; }
.avatar:hover { background: #DDE6FF; }
.avatar:focus-visible { outline: none; box-shadow: var(--focus); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border);
        border-radius: 10px; box-shadow: 0 12px 32px rgba(16,24,40,.12); padding: 6px; z-index: 30; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-head strong { font-size: 14px; }
.menu-head span { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px;
             font-size: 14px; color: var(--text); text-decoration: none; cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--surface-2); }
.menu-item .icon { color: var(--text-3); }
.menu-item.menu-danger { color: var(--danger); border-top: 1px solid var(--border); border-radius: 0 0 6px 6px; margin-top: 4px; }
.menu-item.menu-danger .icon { color: var(--danger); }

.auth { min-height: calc(100vh - var(--topbar-h)); display: grid; place-items: start center; padding: 72px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card-body { padding: 32px; }
.auth-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.auth-sub { color: var(--text-3); font-size: 14px; margin: 6px 0 24px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .btn { margin-top: 4px; }
.auth-switch { margin-top: 20px; font-size: 14px; color: var(--text-3); text-align: center; }
.auth-switch a { font-weight: 600; text-decoration: none; }
.notice-error { background: var(--danger-soft); border: 1px solid #FECDCA; color: #912018; }
.hero-cta { display: flex; gap: 10px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }

/* ---------- My documents ---------- */
.dashboard { max-width: 960px; margin: 0 auto; padding: 40px 24px 96px; }
.dash-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.dash-head p { color: var(--text-3); margin-top: 4px; }
.new-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 24px; }
.new-tile { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
            text-decoration: none; color: inherit; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.new-tile:hover { border-color: #B6C6F5; box-shadow: 0 6px 20px rgba(35,80,216,.08); }
.new-tile:focus-visible { outline: none; box-shadow: var(--focus); }
.new-icon { flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.new-tile strong { display: block; font-size: 15px; }
.new-tile small { display: block; color: var(--text-3); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.list-title { font-size: 15px; font-weight: 650; margin: 40px 0 12px; color: var(--text-2); }
.doc-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
.doc-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; }
.doc-row + .doc-row { border-top: 1px solid var(--border); }
.doc-row:hover { background: var(--surface-2); }
.doc-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 10px; text-decoration: none; color: inherit; border-radius: 8px; }
.doc-row-main:focus-visible { outline: none; box-shadow: var(--focus); }
.doc-row-icon { flex: none; width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: #EEF3FF; color: var(--primary); }
.doc-row-icon.type-cover-letter { background: #ECFDF3; color: #067647; }
.doc-row-icon.type-letter { background: #FEF6EE; color: #B93815; }
.doc-row-text { min-width: 0; display: flex; flex-direction: column; }
.doc-row-text strong { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row-text small { font-size: 13px; color: var(--text-3); }
.doc-row-actions { display: flex; gap: 2px; flex: none; }
.empty-state { padding: 40px 20px; text-align: center; }
.empty-state .muted { color: var(--text-3); font-size: 14px; margin-top: 4px; }

.sheet i.r { width: 45%; } .sheet i.rr { width: 40%; margin-left: 50%; } .sheet i.k { width: 35%; }

/* ---------- Misc ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50;
         background: #101828; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 24px rgba(16,24,40,.2); transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); }
.toast.has-action.is-visible { pointer-events: auto; display: flex; align-items: center; gap: 14px; }
.toast-action { border: 0; background: transparent; color: #9DB5FF; font-weight: 650; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.toast-action:hover { color: #fff; }
.page-message { max-width: 520px; margin: 96px auto; text-align: center; padding: 0 24px; }
.page-message h1 { font-size: 24px; margin-bottom: 8px; }
.page-message p { color: var(--text-2); margin-bottom: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .editor-form { border-right: 0; padding: 20px 16px 120px; }
  .editor-preview { position: static; height: auto; min-height: calc(100vh - var(--topbar-h) - 52px); }
  .editor[data-tab="form"] .editor-preview, .editor[data-tab="preview"] .editor-form { display: none; }
  .mobile-tabs { display: flex; position: sticky; top: var(--topbar-h); z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 16px; gap: 6px; }
  .mobile-tabs button { flex: 1; height: 36px; border: 0; border-radius: 7px; background: transparent; font-weight: 600; font-size: 14px; color: var(--text-3); cursor: pointer; }
  .mobile-tabs button[aria-selected="true"] { background: var(--primary-soft); color: var(--primary); }
  .preview-scroll { padding: 4px 16px 32px; }
  .review { grid-template-columns: 1fr; gap: 24px; padding: 20px 16px 64px; }
  .review-panel { position: static; order: -1; }
  .steps .step-label { display: none; }
  .steps .step.is-current .step-label { display: inline; }
}
@media (max-width: 640px) {
  .topbar-inner { padding: 0 16px; gap: 10px; }
  .topbar-actions, .topbar-view, .topbar-account { gap: 6px; }
  /* Not enough room on phones: the progress steps are hidden, the buttons stay. */
  .steps { display: none !important; }
  .topbar-actions .btn { padding: 0 11px; }
  .lang-switch button { padding: 4px 6px; }
  .form-head { flex-direction: column; gap: 8px; }
  .form-head-text { width: 100%; }
  .doc-title { white-space: normal; overflow-wrap: anywhere; font-size: 21px; }
  .form-head-actions { margin-left: -10px; }
  .form-hint { margin-top: -8px; }
  .home { padding: 40px 16px 64px; }
  .hero p { font-size: 16px; }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field, .field.w-half { grid-column: span 2; }
  .field.w-quarter { grid-column: span 1; }
  .field.w-quarter-3 { grid-column: span 2; }
  .style-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .compact-row .field.w-small, .compact-row .field.w-medium { flex: 1 1 40%; }
  .card-head { padding: 16px 16px 0; }
  .card-body { padding: 14px 16px 16px; }
  .compact-row { flex-wrap: wrap; }
  .compact-row .field { flex: 1 1 100%; }
  .compact-row .field.w-fixed { flex: 1 1 auto; }
  .compact-list .compact-row:not(:first-child) .field label { position: static; width: auto; height: auto; clip: auto; }
  .compact-list .compact-row + .compact-row { border-top: 1px solid var(--border); padding-top: 10px; }
  .form-footer .btn { flex: 1; }
  .topbar-actions .btn-label { display: none; }
  .hide-on-mobile { display: none; }
  .steps:not([hidden]) ~ .topbar-actions .hide-in-editor { display: none; }
  .dashboard { padding: 28px 16px 64px; }
  .doc-row { padding-right: 4px; }
  .doc-row-main { padding: 8px 4px 8px 8px; gap: 10px; }
  .doc-row-actions .icon-btn { width: 30px; }
  .auth { padding: 32px 16px; }
  .auth-card .card-body { padding: 24px 20px; }
}

/* ---------------------------------------------------------------- payment (unlock) */
.hero-price { display: inline-block; margin-top: 4px; padding: 6px 12px; border-radius: 999px; background: var(--primary-soft);
  color: var(--primary); font-weight: 600; font-size: 14px; }
.preview-free { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--warning-soft); border: 1px solid var(--warning-border); color: var(--warning-text); font-size: 13.5px; }
.preview-free .icon { width: 16px; height: 16px; flex: none; }
.unlock { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface-2); margin-bottom: 12px; }
.unlock h2 { display: flex; gap: 8px; align-items: center; font-size: 17px; margin: 0 0 6px; }
.unlock h2 .icon { width: 18px; height: 18px; color: var(--primary); }
.unlock-sub { margin: 0 0 12px; color: var(--text-2); font-size: 13.5px; }
.unlock-steps { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 12px; font-size: 14px; }
.unlock-steps li > strong { display: block; margin-bottom: 6px; }
.unlock-steps .muted { font-size: 13px; }
.unlock-steps .btn { margin-top: 6px; }
.rip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); }
.rip code { font-size: 14px; font-weight: 700; letter-spacing: .02em; word-break: break-all; flex: 1 1 140px; }
.rip-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-3); }
.unlock-guarantee { display: flex; gap: 6px; align-items: center; color: var(--success); font-size: 13px; margin: 4px 0 8px; }
.unlock-guarantee .icon { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- owner page */
.admin .input[type=search] { max-width: 420px; margin: 4px 0 8px; }
.admin-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--text-3); padding: 10px 12px;
  border-bottom: 1px solid var(--border); background: var(--surface-2); }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.status-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.status-pill.is-paid { background: #ECFDF3; border-color: #ABEFC6; color: var(--success); }
