:root {
    --page-bg: #f5f7fb;
    --panel-bg: #ffffff;
    --ink: #18212f;
    --muted: #697386;
    --line: #e5e9f0;
    --brand: #183b56;
    --accent: #15c4b8;
    --shadow: 0 18px 45px rgba(24, 33, 47, 0.08);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

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

a {
    color: inherit;
}

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

.topbar {
    background: linear-gradient(135deg, #ffffff 0%, #eef6ff 100%);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 0;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1, h2 {
    margin: 0;
    line-height: 1.1;
}

h1 {
    font-size: clamp(28px, 4vw, 42px);
    letter-spacing: -0.04em;
}

h2 {
    font-size: 22px;
    letter-spacing: -0.02em;
}

.nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav a {
    text-decoration: none;
    color: var(--brand);
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    font-weight: 700;
    font-size: 14px;
}

.nav a[aria-current="page"] {
    background: var(--brand);
    color: #ffffff;
    border-color: var(--brand);
}

.app-shell {
    display: grid;
    grid-template-columns: 0.92fr 1.08fr;
    gap: 24px;
    padding: 28px 0 40px;
    align-items: start;
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-panel, .preview-panel {
    padding: 24px;
}

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

.grid {
    display: grid;
    gap: 14px;
}

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

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

label {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

input, textarea, select {
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
    resize: vertical;
}

input[type="color"] {
    padding: 5px;
    cursor: pointer;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(21, 196, 184, 0.12);
}

.hint, small {
    color: var(--muted);
    font-weight: 600;
}

.divider {
    height: 1px;
    background: var(--line);
    margin: 18px 0;
}

.logo-tools {
    display: grid;
    grid-template-columns: 1fr;
}

.file-label input {
    padding: 9px;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0;
}

button {
    border: 0;
    border-radius: 12px;
    padding: 12px 16px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

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

.secondary-btn {
    background: #eef6ff;
    color: var(--brand);
}

.ghost-btn {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
}

.preview-stage {
    overflow: auto;
    padding: 24px;
    border: 1px dashed #cad3df;
    border-radius: 18px;
    background:
        linear-gradient(45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef2f7 75%),
        linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
    background-size: 22px 22px;
    background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.signature-preview {
    width: max-content;
    max-width: 100%;
}

.code-label textarea {
    min-height: 210px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre;
}

.notice, .help-note {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fff9e9;
    color: #6f560e;
    border: 1px solid #f6e2a2;
    font-size: 14px;
    line-height: 1.55;
}

.footer {
    border-top: 1px solid var(--line);
    padding: 20px 0;
    color: var(--muted);
    font-size: 14px;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer a {
    color: var(--brand);
    font-weight: 800;
}

.help-shell {
    display: grid;
    gap: 18px;
    padding: 28px 0 40px;
}

.help-panel {
    padding: 26px;
}

.help-panel h2 {
    margin-bottom: 14px;
}

.steps, .check-list {
    margin: 0;
    padding-left: 22px;
    color: #344054;
    line-height: 1.7;
}

.help-panel code {
    background: #f0f3f8;
    padding: 2px 6px;
    border-radius: 6px;
}

.help-panel pre {
    overflow: auto;
    background: #101828;
    color: #e6edf6;
    border-radius: 14px;
    padding: 16px;
    line-height: 1.5;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 10;
    max-width: 340px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #101828;
    color: #ffffff;
    box-shadow: var(--shadow);
    font-weight: 700;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .container {
        width: min(100% - 24px, 1180px);
    }

    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .form-panel, .preview-panel, .help-panel {
        padding: 18px;
    }
}

.advanced-options {
    margin: 4px 0 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfcff;
}

.advanced-options summary {
    cursor: pointer;
    color: var(--brand);
    font-weight: 900;
    font-size: 14px;
}

.advanced-options .grid {
    margin-top: 12px;
}

.field-help {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
    font-weight: 600;
}
