/* LangSync design system tokens, matching hub.langsync.ai / onboarding.langsync.ai */
:root {
  --ls-brand: #0099FF;
  --ls-brand-ink: #0B64A8;
  --ls-brand-wash: #E8F3FF;
  --ls-gradient-from: #128EFE;
  --ls-gradient-to: #9135FC;
  --ls-gradient: linear-gradient(135deg, #128EFE, #9135FC);
  --ls-ink: #0B1220;
  --ls-muted: #5B6472;
  --ls-line: #E9EDF3;
  --ls-surface: #FFFFFF;
  --ls-surface-soft: #FBFCFE;
  --ls-surface-sunken: #F6F8FB;
  --ls-surface-control: #EEF1F6;
  --ls-good: #0F7A44;
  --ls-good-wash: #E6F7EE;
  --ls-bad: #C0392B;
  --ls-bad-wash: #FDECEA;
  --ls-warn: #8A5A00;
  --ls-warn-wash: #FFF4E0;
  --ls-violet: #9135FC;
  --ls-violet-wash: #F3EBFF;
  --ls-radius-sm: 8px;
  --ls-radius: 12px;
  --ls-radius-lg: 16px;
  --ls-shadow-raised: 0 1px 2px rgba(11, 18, 32, .1);
  --ls-shadow-card: 0 16px 40px -24px rgba(11, 18, 32, .35);
  --ls-glow: 0 6px 18px rgba(0, 153, 255, .28);
  --ls-font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --ls-font-display: 'Outfit', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--ls-font-body); color: var(--ls-ink); background: var(--ls-surface-soft); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--ls-font-display); color: var(--ls-ink); margin: 0; line-height: 1.15; font-weight: 700; }
h1 { font-size: 30px; letter-spacing: -.03em; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 600; }
a { color: var(--ls-brand-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ls-muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--ls-brand-ink); margin: 0 0 6px; }
.ic-svg { flex: none; }
.field-texture { background-image: radial-gradient(rgba(11, 18, 32, .045) 1px, transparent 0); background-size: 22px 22px; background-position: -1px -1px; }
.rise { opacity: 0; animation: ls-rise .6s cubic-bezier(.22, 1, .36, 1) forwards; }
@keyframes ls-rise { 0% { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; opacity: 1; } }

/* icon tiles (h-10 w-10 rounded-lg bg-primary/10 text-primary) */
.tile { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--ls-brand-wash); color: var(--ls-brand-ink); }
.tile-good { background: var(--ls-good-wash); color: var(--ls-good); }
.tile-bad { background: var(--ls-bad-wash); color: var(--ls-bad); }
.tile-warn { background: var(--ls-warn-wash); color: var(--ls-warn); }
.tile-violet { background: var(--ls-violet-wash); color: var(--ls-violet); }
.tile-lg { width: 52px; height: 52px; border-radius: 14px; }
.tile-grad { background: var(--ls-gradient); color: #fff; }

/* ---------- layout: white sidebar like LangSync Onboarding ---------- */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar { background: var(--ls-surface); border-right: 1px solid var(--ls-line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-head { text-decoration: none; height: 64px; display: flex; align-items: center; gap: 8px; padding: 0 22px; border-bottom: 1px solid var(--ls-line); }
.lockup { height: 28px; width: auto; display: block; }
.badge { font-size: 12px; font-weight: 500; color: var(--ls-muted); background: var(--ls-surface-control); padding: 2px 8px; border-radius: 6px; }
.side-new { padding: 16px 16px 8px; }
.side-new .btn { width: 100%; justify-content: center; }
.nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--ls-muted); text-decoration: none; font-weight: 500; font-size: 14px; transition: background .2s, color .2s; }
.nav a:hover { background: var(--ls-surface-sunken); color: var(--ls-ink); }
.nav a.on { background: var(--ls-brand-wash); color: var(--ls-brand-ink); font-weight: 600; }
.nav a .count { margin-left: auto; font-size: 12px; font-weight: 600; background: var(--ls-brand); color: #fff; padding: 0 7px; border-radius: 99px; min-width: 20px; text-align: center; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ls-muted); padding: 16px 12px 6px; font-weight: 600; }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--ls-line); display: grid; gap: 4px; }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; min-width: 0; }
.who > div { min-width: 0; }
.who .avatar-lg { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--ls-gradient); color: #fff; font-weight: 600; font-size: 13px; flex: none; }
.who .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .email { font-size: 12px; color: var(--ls-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signout { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 8px; color: var(--ls-muted); font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; }
.signout:hover { background: var(--ls-bad-wash); color: var(--ls-bad); }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 24px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--ls-line); position: sticky; top: 0; z-index: 20; }
.topbar .spacer { flex: 1; }
.content { padding: 32px 36px; max-width: 1240px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; padding: 9px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .2s, box-shadow .2s, border-color .2s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ls-brand); color: #fff; box-shadow: var(--ls-glow); }
.btn.primary:hover { background: var(--ls-brand-ink); }
.btn.accent { background: var(--ls-gradient); color: #fff; box-shadow: 0 6px 18px rgba(145, 53, 252, .25); }
.btn.accent:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--ls-surface); border-color: var(--ls-line); color: var(--ls-ink); box-shadow: var(--ls-shadow-raised); }
.btn.ghost:hover { background: var(--ls-surface-sunken); }
.btn.danger { background: var(--ls-bad); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.danger-text { color: var(--ls-bad); }
.icon-btn { border: 0; background: none; cursor: pointer; padding: 7px; border-radius: 8px; color: var(--ls-muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--ls-surface-control); color: var(--ls-ink); }
button.link { background: none; border: 0; color: var(--ls-brand); font-weight: 600; cursor: pointer; padding: 0 0 0 10px; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--ls-line); background: #fff; border-radius: 12px; padding: 10px 14px; outline: none; color: var(--ls-ink); transition: border-color .2s, box-shadow .2s;
}
input::placeholder, textarea::placeholder { color: rgba(91, 100, 114, .6); }
input:focus, select:focus, textarea:focus { border-color: var(--ls-brand); box-shadow: 0 0 0 4px rgba(0, 153, 255, .1); }
textarea { resize: vertical; }
.search-box { position: relative; }
.search-box .ic-svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ls-muted); pointer-events: none; }
.search-box input { padding-left: 36px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ls-ink); }
.field .hint { font-weight: 400; color: var(--ls-muted); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; margin-bottom: 10px; }
.check input { margin-top: 3px; accent-color: var(--ls-brand); width: 16px; height: 16px; }

.card { background: var(--ls-surface); border: 1px solid var(--ls-line); border-radius: var(--ls-radius); box-shadow: var(--ls-shadow-raised); }
.card-pad { padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--ls-line); gap: 12px; }
.card-head .left { display: flex; align-items: center; gap: 12px; }
.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-title p { margin: 2px 0 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--ls-good-wash); color: var(--ls-good); }
.pill-blue { background: var(--ls-brand-wash); color: var(--ls-brand-ink); }
.pill-amber { background: var(--ls-warn-wash); color: var(--ls-warn); }
.pill-red { background: var(--ls-bad-wash); color: var(--ls-bad); }
.pill-gray { background: var(--ls-surface-control); color: var(--ls-muted); }
.pill-purple { background: var(--ls-violet-wash); color: var(--ls-violet); }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--ls-line); background: #fff; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--ls-brand-ink); box-shadow: var(--ls-shadow-raised); }
.chip .chip-ic { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--ls-gradient); color: #fff; }
.chip.dot { padding-left: 12px; }
.chip.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ls-brand); }

/* ---------- dashboard ---------- */
.hero { position: relative; overflow: hidden; background-color: #F6F9FE; border: 1px solid var(--ls-line); border-radius: var(--ls-radius-lg); padding: 30px 32px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.hero::before { content: ''; position: absolute; width: 380px; height: 380px; right: -80px; top: -200px; border-radius: 50%; background: rgba(0, 153, 255, .14); filter: blur(64px); }
.hero::after { content: ''; position: absolute; width: 320px; height: 320px; right: 220px; bottom: -240px; border-radius: 50%; background: rgba(145, 53, 252, .1); filter: blur(64px); }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 36px; margin-top: 14px; }
.hero p { margin: 8px 0 0; color: var(--ls-muted); max-width: 560px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { padding: 18px 20px; text-decoration: none; color: inherit; display: flex; gap: 14px; align-items: center; transition: box-shadow .2s, border-color .2s; }
.stat:hover { box-shadow: 0 10px 15px -3px rgba(11, 18, 32, .08), 0 4px 6px -4px rgba(11, 18, 32, .04); border-color: #dbe2ec; }
.stat .n { font-family: var(--ls-font-display); font-size: 28px; font-weight: 700; color: var(--ls-ink); line-height: 1.1; letter-spacing: -.02em; }
.stat .l { font-weight: 500; font-size: 13px; color: var(--ls-muted); }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }

.feed { list-style: none; margin: 0; padding: 6px 0; max-height: 540px; overflow: auto; }
.feed li { display: flex; gap: 12px; padding: 11px 22px; align-items: flex-start; }
.feed a { text-decoration: none; color: var(--ls-ink); font-weight: 600; }
.feed a:hover { color: var(--ls-brand-ink); }
.feed .meta { font-size: 12px; color: var(--ls-muted); margin-top: 2px; }
.feed .what { font-size: 14px; }

/* ---------- tables ---------- */
.tabs-row { display: flex; gap: 4px; border-bottom: 1px solid var(--ls-line); padding: 0 14px; overflow-x: auto; }
.tabs-row a { padding: 13px 10px; text-decoration: none; color: var(--ls-muted); font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs-row a:hover { color: var(--ls-ink); }
.tabs-row a.on { color: var(--ls-brand-ink); border-bottom-color: var(--ls-brand); font-weight: 600; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ls-muted); font-weight: 600; padding: 11px 22px; border-bottom: 1px solid var(--ls-line); background: var(--ls-surface-soft); }
table.list td { padding: 14px 22px; border-bottom: 1px solid var(--ls-line); vertical-align: middle; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--ls-surface-soft); }
table.list tr:last-child td { border-bottom: 0; }
.t-title { font-weight: 600; color: var(--ls-ink); display: flex; align-items: center; gap: 8px; }
.t-sub { font-size: 13px; color: var(--ls-muted); }
.avatars { display: flex; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; border: 2px solid #fff; margin-left: -6px; flex: none; }
.avatars .avatar:first-child { margin-left: 0; }
.empty { text-align: center; padding: 56px 20px; color: var(--ls-muted); }
.empty .tile { margin: 0 auto 12px; }
.empty h3 { margin-bottom: 6px; }

/* ---------- wizard ---------- */
.steps { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.steps a { display: flex; align-items: center; gap: 8px; color: var(--ls-muted); text-decoration: none; }
.steps .n { width: 24px; height: 24px; border-radius: 50%; background: var(--ls-surface-control); display: grid; place-items: center; font-size: 12px; }
.steps .on { color: var(--ls-brand-ink); }
.steps .on .n { background: var(--ls-brand); color: #fff; box-shadow: 0 4px 10px rgba(0, 153, 255, .3); }
.steps .done .n { background: var(--ls-good-wash); color: var(--ls-good); }
.steps .sep { width: 28px; height: 1px; background: var(--ls-line); }
.wizard-foot { position: sticky; bottom: 0; background: rgba(251, 252, 254, .92); backdrop-filter: blur(8px); border-top: 1px solid var(--ls-line); padding: 14px 36px; display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin: 28px -36px -32px; }

.dropzone { display: block; border: 1.5px dashed #CBD5E1; border-radius: var(--ls-radius); background: #F6F9FE; padding: 30px; text-align: center; cursor: pointer; transition: background .2s, border-color .2s; }
.dropzone:hover, .dropzone.over { background: var(--ls-brand-wash); border-color: var(--ls-brand); }
.dropzone .tile { margin: 0 auto 10px; }
.doc-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.doc-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--ls-line); border-radius: 12px; background: #fff; }
.doc-icon { background: var(--ls-bad-wash); color: var(--ls-bad); font-size: 10px; font-weight: 700; padding: 5px 6px; border-radius: 6px; letter-spacing: .04em; }
.doc-list .grow { flex: 1; min-width: 0; }

.recipient { display: grid; grid-template-columns: 36px 56px 1fr 1fr 190px 36px; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--ls-line); border-left: 4px solid var(--c); border-radius: 12px; background: #fff; margin-bottom: 10px; }
.recipient .order { width: 56px; text-align: center; }
.recipient .handle { color: var(--ls-muted); text-align: center; }
.recipient .more { grid-column: 2 / -1; }
.recipient .more .field { margin: 0; }
.recipient-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.no-order .recipient { grid-template-columns: 1fr 1fr 190px 36px; }
.no-order .order-col { display: none; }
.no-order .recipient .more { grid-column: 1 / -1; }

/* ---------- document stage (editor + signing) ---------- */
.stage-wrap { display: grid; grid-template-columns: 248px 1fr 268px; height: calc(100vh - 64px); }
.palette, .props { background: var(--ls-surface); border-right: 1px solid var(--ls-line); overflow: auto; padding: 16px; }
.props { border-right: 0; border-left: 1px solid var(--ls-line); }
.stage { overflow: auto; padding: 28px; background: var(--ls-surface-sunken); position: relative; }
.docs { max-width: 880px; margin: 0 auto; }
.doc { margin-bottom: 28px; }
.doc-head { display: flex; gap: 10px; align-items: center; font-weight: 600; color: var(--ls-ink); margin-bottom: 10px; }
.page { position: relative; background: #fff; box-shadow: var(--ls-shadow-card), 0 0 0 1px var(--ls-line); border-radius: 4px; margin-bottom: 20px; width: 100%; user-select: none; }
.page canvas { width: 100%; height: 100%; display: block; border-radius: 4px; }
.page-overlay { position: absolute; inset: 0; }
.page-num { position: absolute; bottom: -18px; right: 0; font-size: 11px; color: var(--ls-muted); }
.markup-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.markup-svg .note { pointer-events: auto; cursor: pointer; }
body.markup-active .markup-svg { pointer-events: auto; cursor: crosshair; z-index: 5; }
body[data-markup-tool=eraser] .markup-svg { cursor: not-allowed; }
body[data-markup-tool=eraser] .markup-svg .mine { cursor: pointer; }
body[data-markup-tool=eraser] .markup-svg .mine:hover { opacity: .45; }
body.markup-active .fld { pointer-events: none; }

.palette h3 { font-family: var(--ls-font-body); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ls-muted); margin: 18px 0 8px; font-weight: 600; }
.palette h3:first-child { margin-top: 0; }
.pal-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 1px solid var(--ls-line); background: #fff; border-radius: 10px; margin-bottom: 6px; cursor: grab; font-weight: 500; font-size: 14px; text-align: left; touch-action: none; transition: border-color .15s, background .15s; }
.pal-item:hover { border-color: var(--c, var(--ls-brand)); background: color-mix(in srgb, var(--c, var(--ls-brand)) 6%, white); }
.pal-item.armed { outline: 2px solid var(--c, var(--ls-brand)); background: color-mix(in srgb, var(--c, var(--ls-brand)) 8%, white); }
.pal-item .ic { width: 28px; height: 28px; border-radius: 8px; background: color-mix(in srgb, var(--c, var(--ls-brand)) 14%, white); color: var(--c, var(--ls-brand-ink)); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.rcp-select { display: flex; flex-direction: column; gap: 6px; }
.rcp-opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--ls-line); cursor: pointer; font-weight: 600; font-size: 14px; background: #fff; text-align: left; }
.rcp-opt.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 7%, white); box-shadow: 0 0 0 1px var(--c); }
.rcp-opt .sw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.mode-switch { display: flex; background: var(--ls-surface-control); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.mode-switch button { flex: 1; border: 0; background: none; padding: 7px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--ls-muted); font-size: 14px; }
.mode-switch button.on { background: #fff; color: var(--ls-ink); box-shadow: var(--ls-shadow-raised); }

.fld { position: absolute; border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border-radius: 6px; font-size: 11px; color: var(--ls-ink); display: flex; align-items: center; padding: 0 5px; overflow: hidden; z-index: 3; }
.fld .fl { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.fld.edit { cursor: move; touch-action: none; }
.fld.sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c); z-index: 4; }
.fld .rz { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; background: var(--c); cursor: nwse-resize; border-radius: 3px 0 4px 0; }
.fld .req { color: var(--ls-bad); margin-left: 2px; }
.ghost-field { position: fixed; pointer-events: none; z-index: 100; border: 1.5px dashed var(--c); background: color-mix(in srgb, var(--c) 16%, white); border-radius: 6px; font-size: 11px; font-weight: 600; display: flex; align-items: center; padding: 0 6px; opacity: .92; }

.markup-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.markup-bar .tool { display: flex; flex-direction: column; align-items: center; gap: 3px; border: 1px solid var(--ls-line); background: #fff; border-radius: 10px; padding: 8px 4px 6px; width: 64px; cursor: pointer; color: var(--ls-ink); }
.markup-bar .tool:hover { background: var(--ls-surface-sunken); }
.markup-bar .tool small { font-size: 10.5px; font-weight: 500; color: var(--ls-muted); }
.markup-bar .tool[aria-pressed=true] { background: var(--ls-brand); color: #fff; border-color: var(--ls-brand); box-shadow: var(--ls-glow); }
.markup-bar .tool[aria-pressed=true] small { color: #E3F2FF; }
.markup-bar .swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--ls-line); cursor: pointer; }
.markup-bar .swatch.on { box-shadow: 0 0 0 2px var(--ls-ink); }
.bar-sep { width: 100%; height: 0; }
.save-state { font-size: 12px; color: var(--ls-muted); }

/* ---------- signing ---------- */
.sign-top { display: flex; align-items: center; gap: 14px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--ls-line); padding: 0 24px; min-height: 64px; position: sticky; top: 0; z-index: 30; flex-wrap: wrap; }
.sign-top .divider { width: 1px; height: 26px; background: var(--ls-line); }
.sign-top .title { font-family: var(--ls-font-display); font-weight: 600; font-size: 16px; }
.sign-top .from { font-size: 13px; color: var(--ls-muted); }
.sign-top .spacer { flex: 1; }
.progress { font-size: 13px; color: var(--ls-muted); display: flex; align-items: center; gap: 8px; }
.progress-bar { width: 90px; height: 6px; border-radius: 99px; background: var(--ls-surface-control); overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--ls-gradient); border-radius: 99px; transition: width .3s; }
.sign-banner { background: #F6F9FE; border-bottom: 1px solid var(--ls-line); padding: 14px 24px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.sign-banner p, .sign-banner .txt { margin: 0; flex: 1; min-width: 240px; }
.sign-stage { padding: 28px 16px 120px; background: var(--ls-surface-sunken); min-height: calc(100vh - 130px); }
.sfld { position: absolute; z-index: 3; border-radius: 6px; display: flex; align-items: center; }
.sfld.todo { background: rgba(0, 153, 255, .12); border: 1.5px solid var(--ls-brand); }
.sfld.todo.optional { background: rgba(145, 53, 252, .06); border: 1.5px dashed var(--ls-violet); }
.sfld.filled { border: 1.5px solid transparent; }
.sfld.filled:hover { border-color: var(--ls-brand); }
.sfld.current { animation: pulse 1.2s ease-in-out 2; box-shadow: 0 0 0 3px var(--ls-brand); }
.sfld input[type=text] { width: 100%; height: 100%; border: 0; background: transparent; padding: 0 4px; border-radius: 0; font-size: clamp(9px, 1.4vw, 14px); }
.sfld input[type=text]:focus { box-shadow: none; background: rgba(255, 255, 255, .75); }
.sfld input[type=checkbox] { width: 100%; height: 100%; margin: 0; accent-color: var(--ls-brand); cursor: pointer; }
.sfld button.sigbtn { width: 100%; height: 100%; border: 0; background: none; cursor: pointer; font-weight: 700; font-size: clamp(9px, 1.3vw, 13px); color: var(--ls-brand-ink); display: flex; align-items: center; justify-content: center; gap: 6px; line-height: 1; }
.sfld img { width: 100%; height: 100%; object-fit: contain; object-position: left center; }
.sfld .val { font-size: clamp(8px, 1.3vw, 14px); padding: 0 3px; white-space: nowrap; overflow: hidden; color: var(--ls-ink); }
.sfld.ro { pointer-events: none; }
.sig-wrap { position: relative; width: 100%; height: 100%; padding-top: 2px; }
.sig-wrap .tag { position: absolute; top: -9px; left: 0; font-size: 8px; font-weight: 700; color: var(--ls-brand-ink); white-space: nowrap; }
.next-btn { position: fixed; left: 0; top: 50%; z-index: 40; background: var(--ls-brand); color: #fff; border: 0; font-weight: 700; padding: 12px 30px 12px 18px; box-shadow: var(--ls-glow); cursor: pointer; clip-path: polygon(0 0, 86% 0, 100% 50%, 86% 100%, 0 100%); font-size: 14px; }
.next-btn:hover { background: var(--ls-brand-ink); }
.sign-tools { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #fff; border: 1px solid var(--ls-line); border-radius: 16px; box-shadow: var(--ls-shadow-card), var(--ls-shadow-raised); padding: 8px; z-index: 40; max-width: calc(100vw - 24px); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.sign-tools .markup-bar .bar-sep { width: 1px; height: 30px; background: var(--ls-line); margin: 0 4px; }
.center-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 24px 16px; }
.center-card { max-width: 520px; width: 100%; text-align: center; padding: 38px 34px; box-shadow: var(--ls-shadow-card), var(--ls-shadow-raised); }
.center-card .tile { margin: 0 auto 16px; }
.center-card h1 { margin-bottom: 10px; font-size: 28px; }
.center-card .btn { margin-top: 20px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(0, 153, 255, .22); } }
body.locked .sfld { pointer-events: none; opacity: .55; }

/* ---------- modals & toasts ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 18, 32, .4); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 200; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: var(--ls-radius-lg); width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 24px 60px -12px rgba(11, 18, 32, .35); border: 1px solid var(--ls-line); }
.modal-wide { width: min(780px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 0; }
.modal-body { padding: 14px 24px 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.note-text { white-space: pre-wrap; color: var(--ls-ink); }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast { background: var(--ls-ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--ls-shadow-card); max-width: 380px; font-size: 14px; display: flex; align-items: center; gap: 10px; transition: opacity .35s, transform .35s; animation: slide .25s; }
.toast-success { background: var(--ls-good); }
.toast-error { background: var(--ls-bad); }
.toast .link { color: #9ED6FF; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ls-line); margin: 6px 0 14px; }
.tab { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--ls-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.on { color: var(--ls-brand-ink); border-bottom-color: var(--ls-brand); }
.adopt-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.font-choices { display: grid; gap: 8px; }
.font-choice { display: grid; grid-template-columns: 22px 1fr 110px; align-items: center; gap: 10px; border: 1px solid var(--ls-line); border-radius: 12px; padding: 8px 12px; cursor: pointer; }
.font-choice:has(input:checked) { border-color: var(--ls-brand); background: #F6F9FE; box-shadow: 0 0 0 1px var(--ls-brand); }
.font-choice input { accent-color: var(--ls-brand); }
.font-sample { font-size: 32px; color: #0B1F4D; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-initials { font-size: 28px; color: #0B1F4D; border-left: 1px solid var(--ls-line); padding-left: 12px; }
.draw-pair { display: grid; grid-template-columns: 3fr 1.1fr; gap: 12px; margin-bottom: 8px; }
.pad { width: 100%; aspect-ratio: 900 / 260; border: 1px dashed #CBD5E1; border-radius: 12px; touch-action: none; cursor: crosshair; display: block; background-color: #FBFCFE; background-image: radial-gradient(rgba(11, 18, 32, .05) 1px, transparent 0); background-size: 18px 18px; }
.pad-small { aspect-ratio: 320 / 260; }
.upload-preview img { max-width: 100%; max-height: 120px; margin-top: 10px; border: 1px dashed var(--ls-line); border-radius: 8px; }
.legal { margin-top: 16px; }
.shake { animation: shake .4s; border-color: var(--ls-bad) !important; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- detail page ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--ls-line); align-items: start; }
.timeline li:last-child { border-bottom: 0; }
.timeline .ord { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; background: var(--c); }
.timeline .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ls-muted); }
.kv dd { margin: 0; color: var(--ls-ink); word-break: break-word; }
.history { width: 100%; border-collapse: collapse; font-size: 13px; }
.history td { padding: 10px 22px; border-bottom: 1px solid var(--ls-line); vertical-align: top; }
.history td:first-child { white-space: nowrap; color: var(--ls-muted); width: 1%; }
.history .ev { display: flex; gap: 10px; align-items: flex-start; }
.history .ev .tile { width: 26px; height: 26px; border-radius: 8px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.preview-docs { max-height: 760px; overflow: auto; padding: 22px; background: var(--ls-surface-sunken); border-radius: 0 0 var(--ls-radius) var(--ls-radius); }
.callout { background: #F6F9FE; border: 1px solid #D6E8FB; border-radius: 12px; padding: 12px 14px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.callout > .ic-svg { margin-top: 2px; color: var(--ls-brand-ink); }
.callout.warn { background: var(--ls-warn-wash); border-color: #F5DDB0; }
.callout.warn > .ic-svg { color: var(--ls-warn); }
.callout.bad { background: var(--ls-bad-wash); border-color: #F5C7C2; }
.callout.bad > .ic-svg { color: var(--ls-bad); }
.callout.good { background: var(--ls-good-wash); border-color: #BFE8D2; }
.callout.good > .ic-svg { color: var(--ls-good); }

/* ---------- auth: same split layout as hub.langsync.ai/login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-main { display: flex; flex-direction: column; padding: 32px 56px; }
.auth-main .center { flex: 1; display: grid; place-items: center; }
.auth-main form { width: 100%; max-width: 380px; }
.auth-main h1 { font-size: 46px; line-height: 1.05; letter-spacing: -.03em; }
.auth-main .lead { font-size: 15px; color: var(--ls-muted); margin: 16px 0 0; line-height: 1.65; }
.auth-main .fields { margin-top: 32px; }
.auth-main input { padding: 12px 16px; font-size: 15px; }
.auth-main .btn.primary { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.auth-main .foot { font-size: 12px; color: var(--ls-muted); }
.auth-aside { position: relative; overflow: hidden; background-color: #F6F9FE; border-left: 1px solid var(--ls-line); display: grid; place-items: center; padding: 56px; }
.auth-aside::before { content: ''; position: absolute; width: 420px; height: 420px; right: -120px; top: -120px; border-radius: 50%; background: rgba(0, 153, 255, .12); filter: blur(64px); }
.auth-aside::after { content: ''; position: absolute; width: 380px; height: 380px; right: 60px; bottom: -180px; border-radius: 50%; background: rgba(145, 53, 252, .08); filter: blur(64px); }
.auth-aside .inner { position: relative; z-index: 1; max-width: 400px; }
.auth-aside h2 { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin-top: 20px; }
.auth-aside p { color: var(--ls-muted); line-height: 1.65; margin: 16px 0 0; }
.auth-aside ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.auth-aside li { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--ls-ink); }
.auth-aside li .ic-svg { color: var(--ls-brand); }
.err { color: var(--ls-bad); font-size: 14px; min-height: 20px; margin: 6px 0; }
.text-link { color: var(--ls-brand-ink); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.verify-box { max-width: 620px; margin: 50px auto; padding: 0 16px; }

@media (max-width: 1100px) {
  .stage-wrap { grid-template-columns: 210px 1fr; }
  .stage-wrap .props { display: none; }
  .grid-2, .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { padding: 28px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--ls-line); }
  .side-head { height: 56px; padding: 0 16px; }
  .side-new { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; padding: 8px; }
  .nav a { padding: 8px 10px; }
  .nav-label, .side-foot .who { display: none; }
  .side-foot { padding: 4px 8px 8px; border: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .recipient, .no-order .recipient { grid-template-columns: 1fr 1fr; }
  .recipient .handle, .recipient .order { display: none; }
  .recipient .more { grid-column: 1 / -1; }
  .stage-wrap { grid-template-columns: 1fr; height: auto; }
  .palette { border-right: 0; border-bottom: 1px solid var(--ls-line); }
  .wizard-foot { margin: 24px -16px -20px; padding: 12px 16px; }
  table.list .hide-sm { display: none; }
  .next-btn { top: auto; bottom: 90px; }
  .hero h1 { font-size: 28px; }
  .auth-main h1 { font-size: 38px; }
  .sign-top { padding: 10px 16px; }
  .sign-top .divider, .sign-top .lockup { display: none; }
}

/* ---------- field panel (DocuSign-style "Standard Fields") ---------- */
@media (min-width: 1101px) { .stage-wrap { grid-template-columns: 300px 1fr 268px; } }
.fields-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.fields-head h2 { font-size: 22px; }
[data-search] { display: block; margin-bottom: 12px; }
.rcp-picker { position: relative; }
.rcp-pill { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 7px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--c) 22%, white); cursor: pointer; font-weight: 600; font-size: 15px; color: var(--ls-ink); text-align: left; transition: background .15s; }
.rcp-pill:hover { background: color-mix(in srgb, var(--c) 30%, white); }
.rcp-pill .rcp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcp-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .7); color: var(--ls-ink); font-size: 12px; font-weight: 600; flex: none; }
.rcp-menu { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--ls-line); border-radius: 14px; box-shadow: var(--ls-shadow-card), var(--ls-shadow-raised); padding: 6px; }
.rcp-menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 600; font-size: 14px; }
.rcp-menu-item .rcp-av { background: color-mix(in srgb, var(--c) 25%, white); }
.rcp-menu-item:hover, .rcp-menu-item.on { background: var(--ls-surface-sunken); }
.pal-divider { height: 1px; background: var(--ls-line); margin: 14px 0 4px; }
.pal-group h4 { font-family: var(--ls-font-body); font-size: 14px; font-weight: 600; color: var(--ls-ink); margin: 16px 0 8px 2px; }
.pal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pal-grid .pal-item { margin: 0; padding: 9px 10px; min-height: 44px; }
.pal-item .pl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item .ic b { font-size: 11px; letter-spacing: -.02em; text-decoration: underline; }
.fld[data-type=radio], .fld[data-type=checkbox] { padding: 0; justify-content: center; }
.fld[data-type=radio] { border-radius: 50%; }
.fld[data-type=approve], .fld[data-type=decline] { justify-content: center; border-radius: 8px; }
.fld[data-type=stamp] { align-items: flex-start; padding-top: 4px; border-style: dashed; }
@media (min-width: 821px) and (max-width: 1100px) { .stage-wrap { grid-template-columns: 260px 1fr; } }

/* ---------- signing chrome (DocuSign-style) ---------- */
.split { position: relative; display: inline-flex; }
.split [data-finish] { border-radius: 12px 0 0 12px; }
.split .split-caret { border-radius: 0 12px 12px 0; padding: 9px 10px; border-left: 1px solid rgba(255, 255, 255, .35); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: #fff; border: 1px solid var(--ls-line); border-radius: 14px; box-shadow: var(--ls-shadow-card), var(--ls-shadow-raised); padding: 6px; z-index: 60; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; background: none; border-radius: 9px; font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; color: var(--ls-ink); }
.menu button:hover { background: var(--ls-surface-sunken); }
.sign-rail { position: fixed; right: 0; top: 64px; bottom: 0; width: 84px; background: #fff; border-left: 1px solid var(--ls-line); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 0; z-index: 25; }
.sign-rail > button { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 72px; padding: 10px 4px; border: 0; background: none; border-radius: 10px; cursor: pointer; color: var(--ls-ink); font-size: 11.5px; font-weight: 500; }
.sign-rail > button:hover { background: var(--ls-surface-sunken); }
.rail-zoom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--ls-muted); }
.rail-zoom button { border: 0; background: none; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--ls-ink); }
.rail-zoom button:hover { background: var(--ls-surface-sunken); }
.sign-stage { padding-right: 100px; }
body:has(.sign-rail) .sign-banner { padding-right: 108px; }
.ready-bar { position: fixed; left: 0; right: 84px; bottom: 0; z-index: 45; background: #fff; border-top: 1px solid var(--ls-line); box-shadow: 0 -10px 30px -18px rgba(11, 18, 32, .3); display: flex; align-items: center; justify-content: center; gap: 48px; padding: 18px 24px; animation: slide .25s; }
.ready-bar h3 { font-family: var(--ls-font-display); font-size: 22px; font-weight: 600; }
.ready-bar p { margin: 4px 0 0; color: var(--ls-muted); }
.ready-bar .btn { padding: 12px 26px; font-size: 15px; }
body:has(.ready-bar:not([hidden])) .sign-tools { bottom: 110px; }
.signed-frame { position: relative; width: 100%; height: 100%; border: 1.5px solid var(--ls-brand-ink); border-radius: 8px; padding: 9px 6px 3px; background: rgba(255, 255, 255, .6); }
.signed-frame .sf-label { position: absolute; top: -7px; left: 8px; background: #fff; padding: 0 4px; font-size: 9px; font-weight: 700; color: var(--ls-ink); line-height: 1.3; }
.signed-frame img { width: 100%; height: 100%; object-fit: contain; object-position: left center; }
.sfld select, .sfld input[type=date] { width: 100%; height: 100%; border: 0; background: transparent; padding: 0 4px; font-size: clamp(9px, 1.3vw, 14px); border-radius: 6px; }
.sfld select:focus, .sfld input[type=date]:focus { box-shadow: none; background: rgba(255, 255, 255, .75); }
.sfld.radio { border-radius: 50%; }
.sfld input[type=radio] { width: 100%; height: 100%; margin: 0; accent-color: var(--ls-brand); cursor: pointer; }
.sfld.action { border: 0; background: none; }
.act-btn { width: 100%; height: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; border: 0; font-weight: 700; font-size: clamp(9px, 1.2vw, 13px); cursor: pointer; color: #fff; }
.act-btn.approve { background: var(--ls-good); }
.act-btn.decline { background: #fff; color: var(--ls-bad); border: 1.5px solid var(--ls-bad); }
.approved-tag { width: 100%; height: 100%; display: grid; place-items: center; border: 1.5px solid var(--ls-good); color: var(--ls-good); border-radius: 6px; font-weight: 700; font-size: clamp(8px, 1.1vw, 12px); }
.page-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
@media (max-width: 820px) {
  .sign-rail { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 60px; flex-direction: row; justify-content: space-around; border-left: 0; border-top: 1px solid var(--ls-line); padding: 4px; }
  .sign-rail > button span { display: none; }
  .rail-zoom { margin: 0; flex-direction: row; }
  .sign-stage { padding-right: 16px; padding-bottom: 150px; }
  body:has(.sign-rail) .sign-banner { padding-right: 16px; }
  .ready-bar { right: 0; bottom: 60px; flex-direction: column; gap: 10px; text-align: center; padding: 14px; }
  .sign-tools { bottom: 74px; }
}
@media print {
  .sign-top, .sign-banner, .sign-rail, .ready-bar, .next-btn, .sign-tools, .toasts, .page-num, .doc-head { display: none !important; }
  .sign-stage { padding: 0; background: none; }
  .docs { max-width: none !important; }
  .page { box-shadow: none; margin: 0; page-break-after: always; break-after: page; }
}
