:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-soft: #f2f6fa;
    --line: #e4ebf2;
    --ink: #152236;
    --muted: #607189;
    --brand: #0f5677;
    --brand-2: #27a4a1;
    --ok: #0c9962;
    --warn: #c67c0a;
    --bad: #c43343;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Manrope, "Segoe UI", sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at 10% 0%, #dbe8f4 0%, transparent 34%), radial-gradient(circle at 90% 20%, #daf4ef 0%, transparent 37%), var(--bg);
}

.site-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.3;
}

.layout {
    position: relative;
    z-index: 1;
    width: min(1220px, 94vw);
    margin: 16px auto 32px;
}

.topbar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(16, 35, 56, 0.06);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.mark {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-family: Sora, sans-serif;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.brand strong {
    display: block;
    font-family: Sora, sans-serif;
}

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

nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

nav a {
    text-decoration: none;
    color: var(--ink);
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 10px;
    padding: 9px 11px;
}

nav a.active {
    color: #fff;
    background: linear-gradient(120deg, var(--brand), #2f6f8f);
}

.lang-switcher {
    margin-top: 6px;
    display: flex;
    gap: 6px;
}

.lang-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid var(--line);
    font-weight: 700;
    text-decoration: none;
    color: var(--muted);
}

.lang-switcher a.active {
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    color: #fff;
}

.login-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.register-link {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--brand);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.register-link:hover {
    border-color: var(--brand);
}

.flash {
    margin-top: 10px;
    border-radius: 12px;
    padding: 11px 14px;
    font-weight: 700;
    border: 1px solid;
}

.flash.success {
    background: #e9f8f1;
    color: #0f6e48;
    border-color: #c8ead9;
}

.flash.error {
    background: #ffeef0;
    color: #972635;
    border-color: #ffc8cf;
}

.hero {
    margin-top: 14px;
    display: grid;
    gap: 14px;
}

.hero article,
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 12px 30px rgba(16, 35, 56, 0.05);
}

.register-card {
    background: radial-gradient(circle at top right, rgba(30, 91, 123, 0.08), transparent 60%), var(--surface);
    border: 1px solid rgba(14, 78, 120, 0.18);
}

.register-card .card-head {
    flex-direction: column;
    align-items: flex-start;
}

.register-card .card-head h2 {
    color: var(--brand);
}

.eyebrow {
    margin: 0;
    font-size: 0.78rem;
    letter-spacing: 0.09em;
    font-weight: 800;
    color: var(--brand);
}

.hero h1 {
    font-family: Sora, sans-serif;
    margin: 8px 0;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
}

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

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

.stats div {
    border: 1px solid #d8e6f2;
    border-radius: 14px;
    padding: 12px;
    background: linear-gradient(155deg, #fdfefe, #ecf3fb);
}

.stats span {
    font-size: 0.78rem;
    color: var(--muted);
}

.stats strong {
    margin-top: 5px;
    display: block;
    font-family: Sora, sans-serif;
    font-size: 1.28rem;
}

.card {
    margin-top: 14px;
}

.card h2 {
    margin: 0 0 10px;
    font-family: Sora, sans-serif;
    font-size: 1.1rem;
}

.members-grid {
    margin-top: 14px;
    display: grid;
    gap: 14px;
}

.login-card {
    min-height: 250px;
}

.card-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
}

.helper-question {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--line);
    color: var(--brand);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.card-head small {
    color: var(--muted);
}

.contract-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.contract-form.single-col {
    grid-template-columns: 1fr;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
    font-size: 0.83rem;
}

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

input,
select,
textarea {
    border: 1px solid #d8e1ea;
    border-radius: 11px;
    padding: 10px 11px;
    background: #fff;
}

.btn {
    border: 0;
    border-radius: 11px;
    padding: 10px 14px;
    cursor: pointer;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    background: linear-gradient(130deg, var(--brand), var(--brand-2));
}

.btn.ghost {
    color: var(--ink);
    border: 1px solid #d7e1ec;
    background: #f2f6fa;
}

.contract-form .btn {
    grid-column: 1 / -1;
}

.signature-wrap {
    grid-column: 1 / -1;
    border: 1px dashed #bacada;
    border-radius: 12px;
    padding: 10px;
    background: #f9fcff;
}

.signature-wrap span {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

#signature-pad {
    width: 100%;
    height: 180px;
    border: 1px solid #d7e1ec;
    border-radius: 10px;
    background: #fff;
}

.signature-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.check {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.check input {
    width: 16px;
    height: 16px;
}

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

.contract-item {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: var(--surface-soft);
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.contract-item strong {
    font-family: Sora, sans-serif;
    font-size: 0.95rem;
}

.contract-item p {
    margin: 4px 0 0;
}

.meta {
    color: var(--muted);
    font-size: 0.82rem;
    word-break: break-word;
}

.meta-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    display: grid;
    gap: 8px;
}

.actions {
    display: flex;
    align-items: flex-start;
}

.discount-form {
    width: 100%;
    display: grid;
    gap: 8px;
    grid-template-columns: 1.3fr 0.6fr 1.3fr auto;
}

.discounts {
    margin-top: 10px;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.discount {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px;
    background: var(--surface-soft);
    display: grid;
    gap: 8px;
    grid-template-columns: 78px 1fr;
}

.discount img {
    width: 78px;
    height: 78px;
    object-fit: cover;
    border-radius: 10px;
}

.discount strong {
    font-family: Sora, sans-serif;
}

.discount p {
    margin: 5px 0 0;
    color: var(--muted);
}

.api-grid {
    margin-top: 14px;
    display: grid;
    gap: 14px;
}

.api-card h3 {
    margin: 0 0 10px;
    font-size: 0.95rem;
}

.api-form {
    display: grid;
    gap: 8px;
}

.api-result {
    margin: 10px 0 0;
    min-height: 120px;
    background: #111d2f;
    color: #d7ebff;
    border-radius: 10px;
    padding: 10px;
    font-size: 0.76rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

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

@media (min-width: 980px) {
    .hero {
        grid-template-columns: 1.25fr 1fr;
    }

    .members-grid {
        grid-template-columns: 1.25fr 1fr;
    }

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

@media (max-width: 860px) {
    .contract-form,
    .discount-form {
        grid-template-columns: 1fr;
    }

    .contract-item {
        flex-direction: column;
    }
}
