:root {
    --ink: #182033;
    --muted: #697386;
    --line: #d9e0ea;
    --surface: #ffffff;
    --bg: #f3f6fa;
    --navy: #263248;
    --coral: #e4572e;
    --coral-dark: #bd3f1c;
    --mint: #2a9d8f;
    --aqua: #dff6f2;
    --amber: #f4a261;
    --danger: #b42318;
    --success: #067647;
    --radius: 8px;
    --shadow: 0 18px 50px rgba(24, 32, 51, 0.12);
    --font: Inter, Arial, Helvetica, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    margin: 0;
    min-height: 100vh;
}

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

button,
input,
select {
    font-family: var(--font);
}

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    left: 0;
    padding: 14px clamp(18px, 5vw, 56px);
    position: sticky;
    right: 0;
    top: 0;
    z-index: 20;
}

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

.topbar nav {
    display: flex;
    gap: 18px;
}

.topbar nav a {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.page {
    display: grid;
    gap: 22px;
    margin: 0 auto;
    max-width: 1180px;
    padding: 28px clamp(16px, 4vw, 40px) 56px;
}

.login-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 72px);
    padding: 28px 16px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: grid;
    gap: 24px;
    max-width: 430px;
    padding: 30px;
    width: 100%;
}

.login-card h1 {
    font-size: 30px;
    line-height: 1.08;
    margin: 8px 0 10px;
}

.login-card p,
.login-hint span {
    color: var(--muted);
    line-height: 1.5;
    margin: 0;
}

.login-hint {
    background: #f9fbfd;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    gap: 4px;
    padding: 14px;
}

.login-hint strong {
    font-size: 13px;
}

.hero {
    background: var(--navy);
    color: #fff;
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    min-height: 390px;
    overflow: hidden;
    padding: clamp(26px, 5vw, 56px);
    position: relative;
}

.hero-copy {
    align-content: center;
    display: grid;
    gap: 18px;
    max-width: 670px;
    z-index: 2;
}

.hero h1 {
    font-size: clamp(34px, 5vw, 62px);
    letter-spacing: 0;
    line-height: 1;
    margin: 0;
}

.hero p {
    color: rgba(255, 255, 255, 0.78);
    font-size: 17px;
    line-height: 1.65;
    margin: 0;
    max-width: 620px;
}

.hero .btn {
    justify-self: start;
}

.hero-visual {
    min-height: 320px;
    position: relative;
}

.paper {
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
    color: var(--ink);
    display: grid;
    gap: 16px;
    padding: 34px;
    position: absolute;
}

.paper-main {
    height: 280px;
    right: 20px;
    top: 32px;
    transform: rotate(3deg);
    width: 230px;
}

.paper span {
    background: #dfe5ee;
    display: block;
    height: 12px;
}

.paper span:nth-child(2) {
    width: 75%;
}

.paper span:nth-child(3) {
    width: 58%;
}

.paper b {
    border-top: 2px solid var(--coral);
    margin-top: auto;
    padding-top: 16px;
}

.flow-node {
    align-items: center;
    background: var(--coral);
    border: 5px solid #fff;
    border-radius: 50%;
    box-shadow: var(--shadow);
    color: #fff;
    display: flex;
    font-size: 22px;
    font-weight: 900;
    height: 74px;
    justify-content: center;
    position: absolute;
    width: 74px;
}

.node-one {
    right: 270px;
    top: 58px;
}

.node-two {
    background: var(--mint);
    right: 300px;
    top: 175px;
}

.node-three {
    background: var(--amber);
    right: 220px;
    top: 258px;
}

.workspace,
.panel,
.document-head,
.stats-grid article,
.sign-panel,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(24, 32, 51, 0.05);
}

.workspace,
.panel,
.document-head,
.sign-panel,
.empty-state {
    padding: 24px;
}

.workspace-title,
.builder-head,
.document-head {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
}

.eyebrow {
    color: var(--coral);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h2 {
    font-size: 24px;
    margin-bottom: 0;
}

.create-form,
.form-stack,
.signer-builder,
.signer-rows {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 22px;
}

.account-box {
    background: #f9fbfd;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    gap: 5px;
    padding: 13px;
}

.account-box span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.account-box small {
    color: var(--muted);
}

label {
    color: var(--muted);
    display: grid;
    font-size: 12px;
    font-weight: 800;
    gap: 7px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

input,
select {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    font-size: 15px;
    min-height: 46px;
    outline: 0;
    padding: 11px 13px;
    width: 100%;
}

input:focus,
select:focus {
    border-color: var(--coral);
    box-shadow: 0 0 0 3px rgba(228, 87, 46, 0.14);
}

.signer-row {
    align-items: end;
    background: #f9fbfd;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px;
    padding: 14px;
}

.btn,
.icon-button,
.link-button {
    border: 0;
    cursor: pointer;
    font-weight: 800;
}

.btn {
    align-items: center;
    border-radius: var(--radius);
    display: inline-flex;
    justify-content: center;
    min-height: 46px;
    padding: 12px 18px;
}

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

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

.btn-secondary {
    background: var(--aqua);
    color: #0d5f57;
}

.submit-btn {
    justify-self: start;
}

.icon-button {
    background: #eef2f7;
    border-radius: var(--radius);
    color: var(--muted);
    height: 46px;
}

.link-button {
    background: transparent;
    color: var(--coral);
    padding: 0;
}

.alert {
    border-radius: var(--radius);
    font-weight: 800;
    left: 50%;
    max-width: 720px;
    padding: 13px 16px;
    position: fixed;
    top: 78px;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    z-index: 40;
}

.alert-error {
    background: #fff1f0;
    border: 1px solid #f2aaa4;
    color: var(--danger);
}

.alert-success {
    background: #ecfdf3;
    border: 1px solid #a6f4c5;
    color: var(--success);
}

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    margin-top: 16px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 14px 10px;
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td {
    color: var(--muted);
    font-size: 14px;
}

td strong,
td span {
    display: block;
}

td strong {
    color: var(--ink);
}

tbody tr {
    cursor: pointer;
}

tbody tr:hover td {
    background: #f9fbfd;
}

.document-head h1 {
    margin-bottom: 6px;
}

.document-head p,
.builder-head p,
.empty-state p,
.sign-panel p {
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 0;
}

.head-actions {
    display: flex;
    gap: 10px;
}

.stats-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid article {
    display: grid;
    gap: 5px;
    padding: 18px;
}

.stats-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.stats-grid strong {
    font-size: 24px;
}

.split-layout {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.iti-banner {
    align-items: center;
    border-radius: var(--radius);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 18px;
}

.iti-banner strong,
.iti-banner span {
    display: block;
}

.iti-banner span {
    font-size: 14px;
    line-height: 1.45;
    margin-top: 4px;
}

.iti-ok {
    background: #ecfdf3;
    border: 1px solid #a6f4c5;
    color: var(--success);
}

.iti-wait {
    background: #fff4e5;
    border: 1px solid #ffd79a;
    color: #9a5b00;
}

.signer-list,
.timeline {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.signer-item {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    gap: 12px;
    grid-template-columns: 44px minmax(0, 1fr) auto auto;
    padding: 14px;
}

.avatar {
    align-items: center;
    background: var(--navy);
    border-radius: 50%;
    color: #fff;
    display: flex;
    font-weight: 900;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.signer-item strong,
.signer-item span,
.signer-item small {
    display: block;
}

.signer-item span,
.signer-item small {
    color: var(--muted);
    font-size: 13px;
}

.pill {
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    padding: 6px 10px;
}

.pill-ok {
    background: #ecfdf3;
    color: var(--success);
}

.pill-wait {
    background: #fff4e5;
    color: #9a5b00;
}

.timeline article {
    border-left: 3px solid var(--coral);
    padding: 2px 0 2px 14px;
}

.timeline span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 800;
}

.timeline strong {
    display: block;
    margin-top: 4px;
}

.sign-shell {
    padding: 28px;
}

.sign-workspace {
    display: grid;
    gap: 18px;
    grid-template-columns: 380px minmax(0, 1fr);
    margin: 0 auto;
    max-width: 1240px;
}

.meta-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0;
}

.meta-list span {
    background: #f3f6fa;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    padding: 7px 10px;
}

.check-row {
    align-items: start;
    display: grid;
    gap: 10px;
    grid-template-columns: 18px minmax(0, 1fr);
    letter-spacing: 0;
    text-transform: none;
}

.check-row input {
    min-height: auto;
}

.document-preview {
    background: #d9e0ea;
    border-radius: var(--radius);
    min-height: calc(100vh - 120px);
    overflow: hidden;
}

.document-preview iframe {
    border: 0;
    height: 100%;
    min-height: calc(100vh - 120px);
    width: 100%;
}

.file-card,
.success-box,
.warning-box {
    border-radius: var(--radius);
    padding: 18px;
}

.file-card {
    background: #fff;
    margin: 24px;
}

.success-box {
    background: #ecfdf3;
    color: var(--success);
    display: grid;
    gap: 5px;
    margin: 18px 0;
}

.warning-box {
    background: #fff4e5;
    color: #9a5b00;
    font-weight: 800;
    margin: 18px 0;
}

code {
    color: var(--ink);
    overflow-wrap: anywhere;
}

@media (max-width: 860px) {
    .hero,
    .form-grid,
    .split-layout,
    .sign-workspace,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .hero-visual {
        display: none;
    }

    .sign-shell {
        padding: 16px;
    }

    .document-preview,
    .document-preview iframe {
        min-height: 520px;
    }
}

@media (max-width: 640px) {
    .topbar nav {
        display: none;
    }

    .workspace-title,
    .builder-head,
    .document-head,
    .head-actions,
    .iti-banner {
        align-items: stretch;
        flex-direction: column;
    }

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