:root {
    --bg: #f6f7f4;
    --surface: #ffffff;
    --surface-strong: #f0f4f3;
    --text: #1f2937;
    --muted: #667085;
    --line: #d8dedb;
    --brand: #0f766e;
    --brand-dark: #0b4f49;
    --amber: #f59e0b;
    --rose: #e11d48;
    --cyan: #0e7490;
    --success: #15803d;
    --shadow: 0 18px 50px rgba(31, 41, 55, .14);
    --field-bg: #fbfdfc;
    --field-height: 52px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-actions,
.drawer-actions,
.form-actions,
.public-actions,
.modal-footer-actions,
.inline-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.brand-symbol {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    background: var(--brand);
    color: #fff;
    font-size: .85rem;
    font-weight: 900;
}

.app-brand {
    padding: 4px 6px 20px;
}

.eyebrow,
.header-kicker {
    margin: 0 0 8px;
    color: #bef3e8;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.eyebrow.dark,
.header-kicker {
    color: var(--brand);
}

.module-header h1,
.public-card h1 {
    margin: 0;
    font-weight: 850;
    line-height: 1.04;
}

.btn,
.icon-button,
.profile-button,
.nav-item,
.link-button {
    border: 0;
    border-radius: 8px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 750;
    transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease, width .24s ease, padding .24s ease;
}

.btn {
    padding: 10px 16px;
    border: 1px solid transparent;
}

.btn:hover,
.icon-button:hover,
.nav-item:hover,
.profile-button:hover {
    transform: translateY(-1px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(15, 118, 110, .22);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-dark);
}

.btn-secondary-light {
    background: rgba(255, 255, 255, .14);
    color: #fff;
    border-color: rgba(255, 255, 255, .28);
}

.btn-ghost-light {
    color: #fff;
}

.btn-outline {
    background: #fff;
    color: var(--text);
    border-color: var(--line);
}

.btn-large {
    min-height: 48px;
    padding-inline: 20px;
}

.btn-small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: .88rem;
}

.btn-full {
    width: 100%;
}

.danger-action {
    color: var(--rose);
}

.icon-button,
.profile-button {
    width: 40px;
    height: 40px;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}

.icon-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lucide {
    flex-shrink: 0;
}

.btn .lucide {
    width: 16px;
    height: 16px;
}

.icon-button .lucide {
    width: 18px;
    height: 18px;
}

.link-button {
    background: none;
    color: var(--brand);
    padding: 0;
    min-height: auto;
}

.public-band,
.public-split {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.public-band {
    padding: 38px 0 24px;
}

.content-grid,
.metric-grid,
.package-grid {
    display: grid;
    gap: 16px;
}

.content-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card,
.content-panel,
.package-card,
.public-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(31, 41, 55, .04);
}

.metric-card,
.package-card,
.public-card {
    padding: 22px;
}

.content-panel h2,
.drawer-content h2,
.public-split h2,
.package-card strong,
.metric-card strong {
    margin: 0;
    line-height: 1.16;
}

.muted-text {
    color: var(--muted);
}

.public-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 38px 0 60px;
}

.public-split h2 {
    max-width: 680px;
    font-size: clamp(1.6rem, 3vw, 2.6rem);
}

.modal[hidden],
.register-step {
    display: none;
}

.modal,
.drawer-shell,
.workspace-shell {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.modal {
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 120;
}

.modal-backdrop,
.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 18, .62);
}

.modal-panel {
    position: relative;
    z-index: 1;
    width: min(480px, 100%);
    max-height: min(760px, calc(100vh - 40px));
    overflow: auto;
    background: #fff;
    border-radius: 8px;
    padding: 26px;
    box-shadow: var(--shadow);
}

.auth-modal h2 {
    margin: 0 0 18px;
    font-size: 1.75rem;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
}

.stack-form,
.settings-form {
    display: grid;
    gap: 16px;
}

.stack-form label:not(.checkbox-line),
.settings-form label,
.filters-bar label,
.list-filter-row label,
.pdf-workspace aside label {
    display: grid;
    min-width: 0;
    gap: 8px;
    color: var(--text);
    font-size: .92rem;
    font-weight: 800;
}

.stack-form label:not(.checkbox-line) > span,
.settings-form label > span,
.filters-bar label > span,
.list-filter-row label > span,
.pdf-workspace aside label > span {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 850;
    line-height: 1.25;
}

.field-control:focus-within > span,
.stack-form label:focus-within:not(.checkbox-line) > span,
.settings-form label:focus-within > span,
.filters-bar label:focus-within > span,
.list-filter-row label:focus-within > span,
.pdf-workspace aside label:focus-within > span {
    color: var(--brand);
}

.field-note {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 650;
    line-height: 1.35;
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
body select,
body textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background-color: var(--field-bg);
    color: var(--text);
    min-height: var(--field-height);
    padding: 13px 14px;
    outline: none;
    font-size: .96rem;
    font-weight: 650;
    line-height: 1.35;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), 0 1px 2px rgba(31, 41, 55, .04);
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease;
}

body select {
    appearance: none;
    cursor: pointer;
    padding-left: 16px;
    padding-right: 52px;
    background-image:
        linear-gradient(90deg, transparent calc(100% - 46px), #edf3f1 calc(100% - 46px)),
        linear-gradient(45deg, transparent 50%, var(--brand-dark) 50%),
        linear-gradient(135deg, var(--brand-dark) 50%, transparent 50%);
    background-position:
        0 0,
        calc(100% - 27px) calc(50% - 2px),
        calc(100% - 20px) calc(50% - 2px);
    background-repeat: no-repeat;
    background-size: 100% 100%, 7px 7px, 7px 7px;
}

body select:hover {
    background-image:
        linear-gradient(90deg, transparent calc(100% - 46px), #e5eeeb calc(100% - 46px)),
        linear-gradient(45deg, transparent 50%, var(--brand-dark) 50%),
        linear-gradient(135deg, var(--brand-dark) 50%, transparent 50%);
}

body select:disabled {
    cursor: not-allowed;
    background-image:
        linear-gradient(90deg, transparent calc(100% - 46px), #e3e7e5 calc(100% - 46px)),
        linear-gradient(45deg, transparent 50%, #8a9491 50%),
        linear-gradient(135deg, #8a9491 50%, transparent 50%);
}

body textarea {
    min-height: 128px;
    padding-inline: 16px;
    resize: vertical;
}

input::placeholder,
body textarea::placeholder {
    color: #98a2b3;
    font-weight: 600;
}

.required-note {
    margin: -6px 0 2px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

.required-mark,
.required-note strong {
    color: var(--rose);
    font-weight: 900;
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):hover,
body select:hover,
body textarea:hover {
    background-color: #fff;
    border-color: #c4cfcb;
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus,
body select:focus,
body textarea:focus {
    border-color: var(--brand);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, .14), 0 4px 12px rgba(31, 41, 55, .08);
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):disabled,
body select:disabled,
body textarea:disabled {
    cursor: not-allowed;
    background-color: #eef1f0;
    color: #8a9491;
}

input[type="file"] {
    padding: 9px 12px;
}

input[type="file"]::file-selector-button {
    min-height: 32px;
    margin-right: 12px;
    padding: 6px 12px;
    border: 0;
    border-radius: 7px;
    background: #eef9f8;
    color: var(--brand-dark);
    font: inherit;
    font-size: .85rem;
    font-weight: 850;
}

.checkbox-line {
    display: flex !important;
    grid-template-columns: none;
    align-items: center;
    gap: 10px;
}

.checkbox-line input {
    width: 18px;
    height: 18px;
}

.register-step.is-active {
    display: grid;
    gap: 14px;
}

.step-dots {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.step-dots span {
    width: 34px;
    height: 5px;
    border-radius: 5px;
    background: var(--line);
}

.step-dots span.active {
    background: var(--brand);
}

.app-shell {
    --sidebar-width: 76px;
    min-height: 100vh;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    background: #0b2023;
}

.app-shell.is-sidebar-expanded {
    --sidebar-width: 240px;
}

.sidebar {
    position: sticky;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 18px;
    padding: 18px 10px;
    background: #0b2023;
    color: #fff;
    overflow: hidden;
    transition: width .24s ease, padding .24s ease;
}

.brand-text,
.nav-copy {
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    white-space: nowrap;
    transform: translateX(-6px);
    transition: max-width .24s ease, opacity .18s ease, transform .18s ease;
}

.app-brand {
    justify-content: center;
    gap: 0;
    padding: 0 0 8px;
}

.app-brand .brand-symbol {
    width: 42px;
    height: 42px;
    background: #0f766e;
    box-shadow: 0 10px 26px rgba(15, 118, 110, .34);
}

.side-nav {
    display: grid;
    align-content: start;
    justify-items: center;
    gap: 12px;
}

.app-shell.is-sidebar-expanded .sidebar {
    padding-inline: 14px;
}

.app-shell.is-sidebar-expanded .app-brand {
    justify-content: flex-start;
    gap: 10px;
    padding-inline: 8px;
}

.app-shell.is-sidebar-expanded .brand-text,
.app-shell.is-sidebar-expanded .nav-copy {
    max-width: 170px;
    opacity: 1;
    transform: translateX(0);
}

.app-shell.is-sidebar-expanded .side-nav:not(.side-nav-bottom) {
    justify-items: stretch;
}

.app-shell.is-sidebar-expanded .side-nav:not(.side-nav-bottom) .nav-item {
    width: 100%;
    justify-content: flex-start;
    padding: 0 12px;
}

.side-nav-bottom {
    align-content: end;
}

.nav-form {
    margin: 0;
}

.nav-item {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
    background: transparent;
    color: rgba(255, 255, 255, .66);
    border-radius: 8px;
}

.nav-item.is-active {
    background: rgba(255, 255, 255, .13);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.nav-item-static {
    cursor: default;
    opacity: .82;
}

.nav-icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    font-size: 1.1rem;
    line-height: 1;
}

.nav-icon .lucide,
.bottom-nav .lucide {
    width: 20px;
    height: 20px;
}

.bottom-nav {
    display: none;
}

.app-main-wrap {
    min-width: 0;
    min-height: calc(100vh - 32px);
    margin: 16px 16px 16px 0;
    overflow: hidden;
    background: #f8faf9;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .26);
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 70px;
    padding: 14px 22px;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.sidebar-toggle {
    display: inline-flex;
}

.credit-pill {
    min-height: 40px;
    padding: 9px 13px;
    border-radius: 8px;
    background: #fff7e6;
    color: #8a5200;
    border: 1px solid #f6d38b;
    font-weight: 800;
}

.profile-button {
    background: var(--brand-dark);
    color: #fff;
    border-color: var(--brand-dark);
}

.app-content {
    width: 100%;
    margin: 0 auto;
    padding: 20px 22px 24px;
}

.module-loader {
    padding: 28px;
    color: var(--muted);
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.module-header h1 {
    font-size: clamp(1.9rem, 4vw, 3rem);
}

.product-workspace {
    display: grid;
    gap: 16px;
}

.workspace-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.workspace-title h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3.2vw, 2.6rem);
    line-height: 1.06;
    font-weight: 850;
}

.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e6ebe9;
    border-radius: 8px;
    box-shadow: 0 14px 36px rgba(31, 41, 55, .08);
}

.credits-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-tile {
    min-height: 96px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: 1fr 1fr;
    column-gap: 12px;
    align-items: center;
    padding: 18px;
    border-right: 1px solid #e6ebe9;
}

.stat-tile:last-child {
    border-right: 0;
}

.stat-tile small {
    align-self: end;
    color: #98a2b3;
    font-weight: 800;
}

.stat-tile strong {
    align-self: start;
    font-size: 1.75rem;
    line-height: 1;
}

.stat-icon {
    grid-row: 1 / span 2;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 900;
}

.stat-icon .lucide,
.avatar-dot .lucide {
    width: 18px;
    height: 18px;
}

.stat-icon.teal,
.avatar-dot.teal {
    background: #0f8f8a;
}

.stat-icon.amber,
.avatar-dot.amber {
    background: #f5a623;
}

.stat-icon.rose,
.avatar-dot.rose {
    background: #ef6074;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(320px, .95fr) minmax(420px, 1.35fr) minmax(300px, .82fr);
    gap: 16px;
    align-items: stretch;
    min-height: 620px;
}

.document-list-panel,
.document-preview-panel,
.right-tool-panel {
    min-width: 0;
    background: #fff;
    border: 1px solid #e3e8e6;
    border-radius: 8px;
    box-shadow: 0 14px 36px rgba(31, 41, 55, .06);
}

.document-list-panel {
    padding: 16px;
}

.compact-heading {
    margin-bottom: 12px;
}

.document-card-list {
    display: grid;
    gap: 10px;
}

.stage-filter-panel {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.stage-filter-toggle {
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e6ebe9;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    text-align: left;
}

.stage-filter-toggle > span {
    display: grid;
    gap: 2px;
}

.stage-filter-toggle small {
    color: #98a2b3;
    font-size: .78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.stage-filter-toggle strong {
    font-size: .96rem;
    line-height: 1.2;
}

.stage-filter-toggle .lucide {
    width: 18px;
    height: 18px;
    color: #667085;
    transition: transform .18s ease;
}

.stage-filter-toggle[aria-expanded="true"] .lucide {
    transform: rotate(180deg);
}

.stage-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.stage-filter-grid[hidden] {
    display: none;
}

.stage-filter {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px;
    border: 1px solid #e6ebe9;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    text-align: left;
}

.stage-filter span {
    color: #667085;
    font-size: .82rem;
    font-weight: 800;
}

.stage-filter strong {
    min-width: 30px;
    min-height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eef1f0;
    font-size: .9rem;
}

.stage-filter.is-active {
    background: #eef9f8;
    border-color: #bfe2df;
    color: #0f766e;
}

.stage-filter.is-active strong {
    background: #0f8f8a;
    color: #fff;
}

.list-filter-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(142px, .62fr);
    gap: 10px;
    margin-bottom: 14px;
}

.document-card {
    position: relative;
    width: 100%;
    min-height: 112px;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 18px 18px;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: #fff;
    border: 1px solid #e6ebe9;
    border-radius: 8px;
    text-align: left;
}

.document-card.is-selected {
    background: #eef9f8;
    border-color: #cce9e6;
}

.document-thumb {
    width: 42px;
    height: 58px;
    border: 1px solid #d8dedb;
    border-radius: 4px;
    background:
        linear-gradient(135deg, transparent 0 74%, #0f8f8a 75%),
        repeating-linear-gradient(0deg, #fff, #fff 9px, #eef1f0 10px);
    box-shadow: 0 8px 16px rgba(31, 41, 55, .08);
}

.document-info {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.document-info strong,
.signer-line strong,
.balance-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-info small,
.signer-line small {
    color: #98a2b3;
    font-weight: 700;
}

.mini-progress {
    width: min(150px, 100%);
    height: 5px;
    display: block;
    overflow: hidden;
    border-radius: 5px;
    background: #e7ecea;
}

.mini-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #0f8f8a;
}

.status-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #cbd5d1;
}

.status-dot.rascunho {
    background: #fff;
}

.status-dot.pendente {
    background: #f5a623;
    border-color: #f5a623;
}

.status-dot.concluido {
    background: #0f8f8a;
    border-color: #0f8f8a;
}

.status-dot.assinado {
    background: #0f8f8a;
    border-color: #0f8f8a;
}

.status-dot.visualizado {
    background: #0e7490;
    border-color: #0e7490;
}

.status-dot.cancelado,
.status-dot.recusado,
.status-dot.expirado {
    background: #ef6074;
    border-color: #ef6074;
}

.more-dot {
    display: grid;
    place-items: center;
    color: #98a2b3;
}

.more-dot .lucide {
    width: 18px;
    height: 18px;
}

.document-preview-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

.history-panel {
    min-height: 0;
    height: clamp(560px, calc(100vh - 220px), 720px);
    grid-template-rows: minmax(0, 1fr);
}

.history-content {
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    padding: 22px;
    background: #fbfdfc;
}

.history-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid #e6ebe9;
    border-radius: 8px;
    background: #fff;
}

.history-header h2 {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.15;
}

.history-subtitle {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 700;
}

.timeline-list {
    display: grid;
    gap: 14px;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    align-items: flex-start;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 21px;
    top: 48px;
    bottom: -16px;
    width: 2px;
    border-radius: 2px;
    background: #dbe5e2;
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-icon {
    position: relative;
    z-index: 1;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid #cbe7e4;
    border-radius: 50%;
    background: #eef9f8;
    color: #0f766e;
    font-weight: 900;
    box-shadow: 0 0 0 4px #fbfdfc;
}

.timeline-icon .lucide {
    width: 20px;
    height: 20px;
}

.timeline-card {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 14px;
    border: 1px solid #e6ebe9;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(31, 41, 55, .05);
}

.timeline-item header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.timeline-item strong {
    line-height: 1.2;
}

.timeline-item time,
.timeline-meta,
.timeline-item p {
    color: var(--muted);
    font-size: .84rem;
}

.timeline-item time {
    flex-shrink: 0;
    text-align: right;
    font-weight: 800;
}

.timeline-item p {
    margin: 0;
}

.timeline-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-weight: 750;
}

.timeline-meta span {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.timeline-meta .lucide {
    width: 15px;
    height: 15px;
}

.timeline-email .timeline-icon {
    border-color: #c9eaf2;
    background: #e5f6fb;
    color: #0e7490;
}

.timeline-sent .timeline-icon {
    border-color: #f6d38b;
    background: #fff7e6;
    color: #ad6a00;
}

.timeline-completed .timeline-icon {
    border-color: #b8e3c7;
    background: #e6f7ed;
    color: #15803d;
}

.history-empty-state {
    min-height: 100%;
}

.empty-panel {
    min-height: 260px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 22px;
    color: var(--muted);
    text-align: center;
}

.empty-panel > span {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid #d8dedb;
    border-radius: 50%;
    color: #0f766e;
    font-size: 1.4rem;
    font-weight: 900;
}

.empty-panel > span .lucide {
    width: 22px;
    height: 22px;
}

.empty-panel strong {
    color: var(--text);
}

.compact-empty {
    min-height: 170px;
    border: 1px dashed #d8dedb;
    border-radius: 8px;
}

.timeline-loading {
    display: grid;
    gap: 12px;
    padding: 20px;
}

.timeline-loading span,
.progressive-loading span {
    min-height: 74px;
    border-radius: 8px;
    background: linear-gradient(90deg, #eef1f0, #f8faf9, #eef1f0);
    background-size: 220% 100%;
    animation: loading-shimmer 1.2s linear infinite;
}

.compact-loading span {
    min-height: 58px;
}

.progressive-loading {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.progressive-loading[hidden] {
    display: none;
}

.progressive-loading span {
    min-height: 92px;
}

.slim-loading span {
    min-height: 58px;
}

.pagination-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    color: var(--muted);
}

.pagination-footer[hidden] {
    display: none;
}

.pagination-footer small {
    font-size: .82rem;
    font-weight: 750;
}

.pagination-footer .btn {
    flex-shrink: 0;
}

.pagination-footer .lucide {
    width: 15px;
    height: 15px;
}

.compact-pagination {
    justify-content: center;
    gap: 8px;
}

.compact-pagination small {
    min-width: 54px;
    text-align: center;
}

.pagination-circle-button {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--text);
    transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
}

.pagination-circle-button:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: #cbdad7;
    background: #f8faf9;
}

.pagination-circle-button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.pagination-circle-button .lucide {
    width: 16px;
    height: 16px;
}

.btn.is-loading .lucide {
    animation: spin 1s linear infinite;
}

.history-pagination {
    padding-left: 54px;
}

.stacked-pagination {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
}

.stacked-pagination small {
    text-align: center;
}

.payments-heading {
    margin-bottom: 0;
}

@keyframes loading-shimmer {
    from {
        background-position: 220% 0;
    }
    to {
        background-position: -220% 0;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.paper-preview {
    position: relative;
    min-height: 100%;
    padding: 68px 42px;
    background: #fff;
}

.paper-preview .line {
    display: block;
    height: 7px;
    width: 76%;
    margin-bottom: 14px;
    border-radius: 7px;
    background: #d8dde0;
}

.paper-preview .line.large {
    width: 42%;
    height: 9px;
    margin-bottom: 22px;
}

.paper-preview .line.short {
    width: 48%;
}

.paper-preview .line.lower {
    margin-top: 190px;
    width: 72%;
}

.signature-box {
    position: absolute;
    display: grid;
    align-items: center;
    padding: 0 16px;
    border: 2px dashed #0f8f8a;
    border-radius: 8px;
    background: #f2fbfa;
    color: #0f766e;
    font-weight: 900;
}

.user-box {
    left: 7%;
    top: 49%;
    width: 31%;
    height: 54px;
}

.sign-box {
    right: 6%;
    top: 58%;
    width: 32%;
    height: 54px;
}

.date-box {
    left: 7%;
    top: 75%;
    width: 31%;
    height: 54px;
    border-color: #f5a623;
    background: #fff8e8;
    color: #ad6a00;
}

.right-tool-panel {
    display: grid;
    align-content: start;
    gap: 16px;
    padding: 16px;
}

.actions-empty {
    min-height: 100%;
}

.selected-contract-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid #d6eeeb;
    border-radius: 8px;
    background: #eef9f8;
}

.selected-contract-card h2 {
    margin: 0 0 10px;
    font-size: 1.2rem;
    line-height: 1.2;
}

.quick-action-list,
.action-meta-list {
    display: grid;
    gap: 10px;
}

.balance-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid #e6ebe9;
    border-radius: 8px;
}

.balance-card div {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.settings-profile-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid #d6eeeb;
    border-radius: 8px;
    background: #eef9f8;
}

.settings-profile-card div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.settings-profile-card strong,
.settings-profile-card small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-profile-card small {
    color: var(--muted);
    font-weight: 750;
}

.settings-profile-badge {
    justify-self: end;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 8px;
    background: #dff5f2;
    color: var(--brand-dark);
    font-size: .72rem;
    font-weight: 900;
    white-space: nowrap;
}

.settings-avatar {
    width: 42px;
    height: 42px;
    font-size: 1rem;
}

.settings-side-status {
    justify-self: end;
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 8px;
    background: #eef1f0;
    color: #475467;
    font-size: .74rem;
    font-weight: 850;
}

.soft-button {
    background: #f8faf9;
}

.signer-stack {
    display: grid;
    gap: 8px;
}

.signer-line {
    width: 100%;
    min-height: 58px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #fff;
    text-align: left;
}

.signer-line.is-active {
    background: #eef9f8;
    border-color: #d6eeeb;
}

.avatar-dot {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 900;
}

.signer-line span:nth-child(2) {
    min-width: 0;
    display: grid;
}

.signer-line i {
    color: #6b7678;
    font-style: normal;
}

.avatar-dot .lucide {
    color: #fff;
}

.signer-line > .badge {
    justify-self: end;
}

.signer-line > .lucide {
    width: 18px;
    height: 18px;
    color: #6b7678;
}

.tool-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid #e6ebe9;
    border-radius: 8px;
}

.drop-zone {
    min-height: 112px;
    display: grid;
    place-items: center;
    border: 2px dashed #d8dedb;
    border-radius: 8px;
    color: #a8b1b4;
    font-size: 2rem;
}

.tool-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.tool-row button {
    min-height: 38px;
    border: 1px solid #d8dedb;
    border-radius: 6px;
    background: #fff;
    color: #29363a;
    font-weight: 900;
}

.workspace-filters {
    margin-bottom: 0;
    padding: 14px;
    background: #fff;
    border: 1px solid #e3e8e6;
    border-radius: 8px;
}

.credits-grid {
    grid-template-columns: minmax(320px, .9fr) minmax(360px, 1fr) minmax(360px, 1fr);
}

.package-card-list {
    gap: 12px;
}

.package-card-item {
    display: grid;
    gap: 14px;
    padding: 14px;
    border: 1px solid #e6ebe9;
    border-radius: 8px;
    background: #fff;
}

.package-card-item:hover {
    border-color: #cbe7e4;
    box-shadow: 0 10px 26px rgba(31, 41, 55, .07);
}

.package-title-row,
.package-buy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.package-title-row {
    align-items: flex-start;
}

.package-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.package-copy strong {
    font-size: 1.05rem;
}

.package-copy small,
.package-buy-row small {
    color: var(--muted);
    font-weight: 750;
}

.package-buy-row {
    padding-top: 12px;
    border-top: 1px solid #edf1ef;
}

.package-buy-row > span {
    display: grid;
    gap: 1px;
}

.package-buy-row strong {
    font-size: 1.25rem;
    line-height: 1.1;
}

.package-document-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 92px;
}

.package-document-card .stat-icon {
    grid-row: auto;
}

.ledger-panel {
    min-height: 520px;
}

.ledger-list {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 18px;
}

.ledger-list h2 {
    margin: 0;
}

.ledger-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.ledger-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.credit-amount {
    justify-self: end;
    min-width: 46px;
    padding: 4px 8px;
    border-radius: 8px;
    background: #eef1f0;
    text-align: center;
}

.credit-amount.positive {
    background: #e6f7ed;
}

.credit-amount.negative {
    background: #ffe6eb;
}

.settings-grid {
    grid-template-columns: minmax(320px, .78fr) minmax(620px, 1.62fr);
    align-items: start;
    min-height: auto;
}

.settings-side-card {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 14px;
}

.settings-form-panel {
    display: block;
    min-height: auto;
    overflow: visible;
}

.settings-form-panel .settings-form {
    display: grid;
    padding: 0;
}

.settings-section {
    display: grid;
    gap: 18px;
    padding: 24px;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 96px;
}

.settings-section:last-of-type {
    border-bottom: 0;
}

.settings-section h2 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.2;
}

.section-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 12px;
}

.section-heading small {
    display: block;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 750;
    line-height: 1.35;
}

.section-heading-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid #d6eeeb;
    border-radius: 8px;
    background: #eef9f8;
    color: var(--brand);
}

.section-heading-icon .lucide {
    width: 20px;
    height: 20px;
}

.settings-template-heading {
    grid-template-columns: auto minmax(240px, 1fr) minmax(260px, .9fr);
}

.settings-side-nav {
    display: grid;
    gap: 8px;
    padding: 8px;
    border: 1px solid #e6ebe9;
    border-radius: 8px;
    background: #f8faf9;
}

.settings-side-nav a {
    min-height: 42px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #344054;
    font-size: .88rem;
    font-weight: 850;
}

.settings-side-nav a:hover,
.settings-side-nav a:focus-visible,
.settings-side-nav a.is-active {
    border-color: #d6eeeb;
    background: #fff;
    color: var(--brand-dark);
}

.settings-side-nav a.is-active {
    border-color: #bfe2df;
    background: #eef9f8;
}

.settings-side-nav .lucide {
    width: 17px;
    height: 17px;
}

.settings-side-nav a .lucide:last-child {
    justify-self: end;
    color: #98a2b3;
}

.settings-summary-groups {
    display: grid;
    gap: 12px;
}

.settings-summary-group {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e6ebe9;
    border-radius: 8px;
    background: #fff;
}

.settings-summary-heading {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.settings-summary-heading > .lucide {
    width: 34px;
    height: 34px;
    padding: 8px;
    border-radius: 8px;
    background: #f0f4f3;
    color: var(--brand);
}

.settings-summary-heading span {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.settings-summary-heading small {
    color: var(--brand);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.settings-summary-heading strong {
    overflow: hidden;
    color: var(--text);
    font-size: .95rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-summary-list {
    display: grid;
    border-top: 1px solid #eef1f0;
}

.settings-summary-item {
    display: grid;
    grid-template-columns: minmax(96px, .72fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 9px 0;
    border-bottom: 1px solid #eef1f0;
}

.settings-summary-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.settings-summary-item small {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 850;
}

.settings-summary-item strong {
    min-width: 0;
    color: var(--text);
    font-size: .86rem;
    font-weight: 850;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.template-token-list {
    max-width: 390px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.template-token-list span {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 8px;
    background: #eef1f0;
    color: #475467;
    font-size: .78rem;
    font-weight: 850;
}

.settings-form-panel .form-actions {
    justify-content: flex-end;
    padding: 16px 24px 24px;
    border-top: 1px solid #edf1ef;
    background: #fff;
}

.settings-section:focus {
    outline: none;
}

.settings-section.is-scroll-focus {
    animation: settings-section-focus 1.1s ease;
}

@keyframes settings-section-focus {
    0% {
        background: #eef9f8;
        box-shadow: inset 4px 0 0 var(--brand);
    }

    100% {
        background: transparent;
        box-shadow: inset 0 0 0 rgba(15, 118, 110, 0);
    }
}

.metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.metric-card {
    min-height: 124px;
    display: grid;
    align-content: space-between;
}

.metric-card span,
.package-card span {
    color: var(--muted);
    font-weight: 750;
}

.metric-card strong {
    font-size: clamp(1.45rem, 3vw, 2.35rem);
}

.accent-card {
    background: #fff7e6;
    border-color: #f6d38b;
}

.content-panel {
    padding: 18px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.contract-list,
.simple-list {
    display: grid;
    gap: 10px;
}

.contract-row,
.list-line {
    width: 100%;
    min-height: 62px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    text-align: left;
}

.contract-row small,
.list-line small,
.data-table small {
    display: block;
    color: var(--muted);
    font-size: .82rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 8px;
    font-size: .78rem;
    font-weight: 850;
    white-space: nowrap;
}

.badge-muted {
    background: #eef1f0;
    color: #475467;
}

.badge-warning {
    background: #fff4d6;
    color: #976400;
}

.badge-info {
    background: #e5f6fb;
    color: #0e7490;
}

.badge-success {
    background: #e6f7ed;
    color: #15803d;
}

.badge-danger {
    background: #ffe6eb;
    color: #be123c;
}

.filters-bar,
.credit-summary,
.two-column,
.form-grid {
    display: grid;
    gap: 16px;
}

.filters-bar {
    grid-template-columns: minmax(220px, 1fr) 180px 180px;
    align-items: end;
    margin-bottom: 18px;
}

.table-wrap {
    width: 100%;
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

.data-table th,
.data-table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 850;
}

.credit-summary {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 18px;
}

.package-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 18px;
}

.package-card {
    display: grid;
    gap: 12px;
}

.package-card strong {
    font-size: 1.55rem;
}

.package-card p {
    margin: 0;
    color: var(--muted);
}

.two-column {
    grid-template-columns: 1fr 1fr;
}

.positive {
    color: var(--success);
    font-weight: 850;
}

.negative {
    color: var(--rose);
    font-weight: 850;
}

.settings-panel {
    max-width: 900px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .full-span {
    grid-column: 1 / -1;
}

.drawer-shell {
    display: flex;
    justify-content: flex-end;
}

.drawer-panel {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    height: 100%;
    overflow: auto;
    background: #fff;
    box-shadow: var(--shadow);
}

.drawer-content {
    padding: 24px;
}

.drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.drawer-header h2 {
    font-size: 1.65rem;
}

.detail-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: .9rem;
}

.drawer-section {
    padding-top: 18px;
}

.drawer-section h3 {
    margin: 0 0 10px;
}

.public-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    background: var(--bg);
}

.public-card {
    width: min(620px, 100%);
    display: grid;
    gap: 16px;
}

.signature-public-page {
    place-items: start center;
}

.signature-card {
    width: min(1180px, 100%);
}

.signature-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.signature-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: 18px;
    align-items: start;
}

.document-review-panel,
.signature-side-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.document-frame {
    width: 100%;
    min-height: 72vh;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
}

.document-fallback,
.document-unavailable {
    min-height: 340px;
    display: grid;
    place-items: center;
    gap: 12px;
    padding: 24px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--muted);
    text-align: center;
}

.document-unavailable span {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #fff4d6;
    color: #7c4a03;
}

.document-unavailable .lucide {
    width: 24px;
    height: 24px;
}

.signature-side-panel {
    position: sticky;
    top: 18px;
    display: grid;
    gap: 16px;
}

.signature-section {
    display: grid;
    gap: 10px;
}

.signature-section h2 {
    margin: 0;
    font-size: 1rem;
}

.proof-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.proof-list li {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
    color: var(--muted);
    font-size: .9rem;
}

.proof-list .lucide {
    width: 16px;
    height: 16px;
    color: var(--brand);
}

.signature-acceptance-form {
    display: grid;
    gap: 12px;
}

.acceptance-line {
    align-items: flex-start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--field-bg);
}

.acceptance-line span {
    color: var(--text);
    font-size: .92rem;
    line-height: 1.45;
}

.btn:disabled,
.icon-button:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.success-box,
.warning-box {
    display: grid;
    gap: 6px;
    border-radius: 8px;
    padding: 12px;
}

.success-box {
    background: #e6f7ed;
    color: #14532d;
}

.warning-box {
    background: #fff4d6;
    color: #7c4a03;
}

#toast-root {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 80;
    display: grid;
    gap: 10px;
}

.toast {
    width: min(360px, calc(100vw - 36px));
    padding: 12px 14px;
    border-radius: 8px;
    background: #101817;
    color: #fff;
    box-shadow: var(--shadow);
}

.toast.error {
    background: #8f1233;
}

.workspace-shell {
    top: 16px;
    right: 16px;
    bottom: 16px;
    left: var(--sidebar-width);
    z-index: 70;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    background: #f6f7f4;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .26);
    transition: left .24s ease;
}

.workspace-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.workspace-body {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
}

.wizard-main {
    min-width: 0;
    overflow: auto;
    padding: 22px;
}

.wizard-side {
    border-left: 1px solid var(--line);
    background: #fff;
    padding: 20px;
    overflow: auto;
}

.progress-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.progress-step {
    min-height: 38px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 850;
    font-size: .85rem;
}

.progress-step.is-active,
.progress-step.is-done {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.wizard-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
}

.signer-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(240px, 1fr) auto;
    gap: 14px;
    align-items: end;
    margin-bottom: 14px;
}

.pdf-workspace {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(280px, 320px);
    gap: 18px;
}

.pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.pdf-page {
    position: relative;
    min-height: 560px;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #f7faf9;
    overflow: hidden;
    box-shadow: 0 16px 38px rgba(31, 41, 55, .08);
}

.pdf-page canvas {
    position: relative;
    z-index: 1;
    display: block;
    max-width: 100%;
    background: #fff;
}

.pdf-placeholder {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 18px;
    background: #fff;
    color: var(--muted);
    font-weight: 850;
    text-align: center;
}

.pdf-placeholder[hidden] {
    display: none;
}

.pdf-field-layer {
    position: absolute;
    inset: 0;
    z-index: 3;
}

.pdf-page-error {
    min-height: 560px;
}

.signature-field {
    position: absolute;
    min-width: 120px;
    min-height: 52px;
    border: 2px solid var(--brand);
    border-radius: 8px;
    background: rgba(15, 118, 110, .1);
    color: var(--brand-dark);
    resize: both;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 36px 8px 12px;
    font-weight: 850;
    font-size: .82rem;
    text-align: center;
    user-select: none;
}

.signature-field-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

.signature-field-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(225, 29, 72, .22);
    border-radius: 999px;
    background: #fff;
    color: var(--rose);
    box-shadow: 0 6px 14px rgba(31, 41, 55, .12);
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.signature-field-remove:hover {
    transform: translateY(-1px);
    border-color: rgba(225, 29, 72, .42);
    background: #fff1f4;
}

.signature-field-remove .lucide {
    width: 14px;
    height: 14px;
    stroke-width: 2.4;
}

.signer-chip {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px;
    background: #fff;
}

@media (max-width: 980px) {
    .content-grid,
    .metric-grid,
    .package-grid,
    .two-column,
    .credit-summary,
    .form-grid,
    .pdf-workspace {
        grid-template-columns: 1fr 1fr;
    }

    .app-shell {
        --sidebar-width: 0px;
        grid-template-columns: 1fr;
        background: #f8faf9;
    }

    .sidebar {
        display: none;
    }

    .app-main-wrap {
        min-height: 100vh;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .stats-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-tile:nth-child(2) {
        border-right: 0;
    }

    .stat-tile:nth-child(-n+2) {
        border-bottom: 1px solid #e6ebe9;
    }

    .workspace-grid {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .settings-form-panel {
        min-height: auto;
    }

    .document-preview-panel.settings-form-panel {
        min-height: auto;
    }

    .settings-side-nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .settings-side-nav a {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .settings-side-nav a .lucide:last-child {
        display: none;
    }

    .settings-summary-groups {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .settings-summary-item {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .settings-template-heading {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .settings-template-heading .template-token-list {
        grid-column: 2;
        max-width: none;
        justify-content: flex-start;
    }

    .signature-layout {
        grid-template-columns: 1fr;
    }

    .signature-side-panel {
        position: static;
    }

    .document-preview-panel {
        min-height: 560px;
    }

    .sidebar-toggle {
        display: none;
    }

    .bottom-nav {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
        z-index: 30;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        padding: 6px;
        border-radius: 8px;
        background: #101817;
        box-shadow: var(--shadow);
    }

    .bottom-nav .nav-item {
        width: 100%;
        height: 44px;
        justify-content: center;
        min-height: 44px;
        padding: 8px;
    }

    .app-content {
        padding-bottom: 92px;
    }

    .workspace-body {
        grid-template-columns: 1fr;
    }

    .workspace-shell {
        inset: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .wizard-side {
        border-left: 0;
        border-top: 1px solid var(--line);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .brand-text,
    .nav-copy,
    .nav-item,
    .workspace-shell {
        transition: none;
    }
}

@media (max-width: 720px) {
    .public-band,
    .public-split,
    .app-content {
        width: min(100% - 28px, 1180px);
    }

    .app-header,
    .module-header,
    .signature-page-header,
    .public-split {
        align-items: stretch;
        flex-direction: column;
    }

    .document-frame {
        min-height: 62vh;
    }

    .header-actions .btn {
        flex: 1;
    }

    .content-grid,
    .metric-grid,
    .package-grid,
    .two-column,
    .credit-summary,
    .form-grid,
    .filters-bar,
    .list-filter-row,
    .pdf-workspace,
    .stats-strip {
        grid-template-columns: 1fr;
    }

    .stat-tile,
    .stat-tile:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid #e6ebe9;
    }

    .stat-tile:last-child {
        border-bottom: 0;
    }

    .app-header {
        padding: 14px;
    }

    .app-content {
        padding: 16px 14px 92px;
    }

    .workspace-title {
        flex-direction: column;
        align-items: stretch;
    }

    .workspace-title > .btn,
    .workspace-title form .btn {
        width: 100%;
    }

    .section-heading {
        display: grid;
    }

    .section-heading small {
        max-width: none;
        text-align: left;
    }

    .document-card {
        grid-template-columns: 48px minmax(0, 1fr) 16px;
    }

    .document-card .more-dot {
        display: none;
    }

    .history-content {
        padding: 16px;
    }

    .history-header,
    .timeline-item header {
        display: grid;
    }

    .timeline-item {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 10px;
    }

    .timeline-item::before {
        left: 18px;
        top: 42px;
    }

    .timeline-icon {
        width: 38px;
        height: 38px;
    }

    .timeline-icon .lucide {
        width: 18px;
        height: 18px;
    }

    .timeline-item time {
        text-align: left;
    }

    .package-buy-row {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .package-buy-row .btn {
        width: 100%;
    }

    .ledger-line {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: flex-start;
    }

    .ledger-line .credit-amount {
        grid-column: 2;
        justify-self: start;
    }

    .template-token-list {
        justify-content: flex-start;
    }

    .settings-profile-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .settings-profile-badge {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .settings-side-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-summary-groups {
        grid-template-columns: 1fr;
    }

    .settings-summary-item {
        grid-template-columns: minmax(92px, .62fr) minmax(0, 1fr);
        gap: 10px;
    }

    .settings-section {
        padding: 20px;
    }

    .settings-template-heading .template-token-list {
        grid-column: 1 / -1;
    }

    .settings-form-panel .form-actions {
        padding: 14px 20px 20px;
    }

    .settings-form-panel .form-actions .btn {
        width: 100%;
    }

    .paper-preview {
        padding: 52px 22px;
    }

    .user-box,
    .sign-box,
    .date-box {
        left: 8%;
        right: auto;
        width: 72%;
    }

    .header-actions {
        width: 100%;
    }

    .credit-pill {
        flex: 1;
        justify-content: center;
        text-align: center;
    }

    .signer-row {
        grid-template-columns: 1fr;
    }

    .workspace-header {
        align-items: stretch;
        flex-direction: column;
    }

    .progress-bar {
        grid-template-columns: 1fr 1fr;
    }

    .pdf-page {
        min-height: 460px;
    }
}

.signer-status-list {
	padding-top: 10px;
}
