:root {
    --red: #bd1e24;
    --red-dark: #9a181d;
    --red-soft: #fdf2f2;
    --ink: #1c1f23;
    --muted: #6b7076;
    --line: #e3e6e9;
    --bg: #f4f6f8;
    --ok: #1a7f4b;
    --radius: 14px;
    --tap: 52px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar img {
    height: 26px;
    width: auto;
    display: block;
}

.topbar a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.wrap {
    max-width: 780px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.wrap.wide {
    max-width: 1180px;
}

h1 {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.25;
    margin: 8px 0 4px;
    letter-spacing: -0.01em;
}

.lead {
    color: var(--muted);
    margin: 0 0 24px;
    font-size: 15px;
}

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 18px;
    margin-bottom: 16px;
}

.card > h2 {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--red);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card > h2 .num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-size: 12px;
    flex: 0 0 auto;
}

.field {
    margin-bottom: 16px;
}

.field:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.req {
    color: var(--red);
}

.hint {
    font-size: 13px;
    color: var(--muted);
    margin: 6px 0 0;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    appearance: none;
}

textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7076' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(189, 30, 36, 0.14);
}

.grid2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 620px) {
    .grid2 {
        grid-template-columns: 1fr 1fr;
    }

    .wrap {
        padding: 28px 24px 60px;
    }

    .card {
        padding: 26px 24px;
    }

    h1 {
        font-size: 30px;
    }
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    font-weight: 500;
    font-size: 15px;
    transition: border-color 0.15s, background 0.15s;
}

.check:last-of-type {
    margin-bottom: 0;
}

.check input {
    width: 24px;
    height: 24px;
    margin: 1px 0 0;
    accent-color: var(--red);
    flex: 0 0 auto;
}

.check:has(input:checked) {
    border-color: var(--red);
    background: var(--red-soft);
}

.check > span:first-of-type {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.price-tag {
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 700;
    color: var(--red);
    white-space: nowrap;
    text-align: right;
}

.price-tag-included {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    white-space: normal;
    max-width: 68px;
    line-height: 1.3;
}

.totals {
    margin: 16px 0 20px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    background: #fafbfc;
    font-size: 15px;
}

.totals > div,
#totals-surcharges > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 3px 0;
    color: var(--muted);
}

.totals span:first-child {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.totals span:last-child {
    flex: 0 0 auto;
    white-space: nowrap;
    text-align: right;
}

#totals-surcharges {
    display: block;
    padding: 0;
}

#totals-surcharges > div {
    font-size: 14px;
}

.totals .totals-sum {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-weight: 800;
    font-size: 17px;
    align-items: baseline;
}

.totals .totals-sum span:last-child {
    color: var(--red);
    font-size: 20px;
    white-space: nowrap;
}

.terms {
    counter-reset: term;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.terms li {
    counter-increment: term;
    position: relative;
    padding-left: 30px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #3d4348;
    line-height: 1.5;
}

.terms li::before {
    content: counter(term) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
    color: var(--red);
}

.privacy {
    margin-top: 16px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.privacy summary {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
}

.privacy summary::-webkit-details-marker {
    display: none;
}

.privacy summary::before {
    content: "";
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-right: 2px solid var(--red);
    border-bottom: 2px solid var(--red);
    transform: rotate(-45deg);
    transition: transform 0.18s ease;
}

.privacy[open] summary::before {
    transform: rotate(45deg);
}

.privacy dl {
    margin: 12px 0 0;
    font-size: 13px;
    line-height: 1.55;
}

.privacy dt {
    font-weight: 700;
    color: var(--ink);
    margin-top: 10px;
}

.privacy dd {
    margin: 2px 0 0;
    color: var(--muted);
}

.sig-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 128px;
    padding: 12px;
    border: 2px dashed var(--line);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    color: #9aa0a6;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
}

.sig-trigger:active {
    background: var(--bg);
}

.sig-trigger.signed {
    border-style: solid;
    border-color: var(--ok);
    color: var(--ink);
}

.sig-trigger img {
    max-width: 100%;
    max-height: 150px;
    display: block;
}

.sig-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(16, 19, 22, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.sig-modal[hidden] {
    display: none;
}

.sig-modal-inner {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 720px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sig-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 16px;
}

.sig-modal-close {
    border: none;
    background: none;
    font-size: 20px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 8px 10px;
    margin: -8px -10px -8px 0;
}

.sig-modal-body {
    padding: 16px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.sig-pad {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    flex: 1;
    min-height: 200px;
}

.sig-pad canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: crosshair;
}

.sig-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b3b8bd;
    font-size: 15px;
    pointer-events: none;
    font-weight: 500;
}

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

.sig-baseline {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--ink);
    font-size: 13px;
    color: var(--muted);
}

.sig-modal-foot {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
}

.sig-modal-foot .btn {
    flex: 1;
}

.sig-modal-foot .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

body.sig-open {
    overflow: hidden;
}

@media (max-height: 520px) {
    .sig-modal {
        padding: 8px;
    }

    .sig-modal-head {
        padding: 8px 14px;
    }

    .sig-modal-body {
        padding: 10px 14px;
    }

    .sig-pad {
        min-height: 140px;
    }

    .sig-modal-foot {
        padding: 10px 14px;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--tap);
    padding: 13px 24px;
    border: none;
    border-radius: 10px;
    background: var(--red);
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.btn:active {
    background: var(--red-dark);
}

.btn-block {
    width: 100%;
}

.btn-ghost {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    font-weight: 600;
}

.btn-ghost:active {
    background: var(--bg);
}

.btn-sm {
    min-height: 40px;
    padding: 8px 16px;
    font-size: 14px;
}

.alert {
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.alert-error {
    background: var(--red-soft);
    border: 1px solid #f0c3c5;
    color: #8c1519;
}

.alert-ok {
    background: #edf8f2;
    border: 1px solid #bfe3d0;
    color: #14603a;
}

.error {
    color: var(--red);
    font-size: 13px;
    font-weight: 600;
    margin-top: 6px;
}

.has-error input,
.has-error select,
.has-error textarea,
.has-error .sig-trigger {
    border-color: var(--red);
}

.has-error .check {
    border-color: var(--red);
    background: var(--red-soft);
}

.has-error .check input {
    outline: 2px solid var(--red);
    outline-offset: 2px;
    border-radius: 4px;
}

.submit-bar {
    position: sticky;
    bottom: 0;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    margin: 24px -16px 0;
}

@media (min-width: 620px) {
    .submit-bar {
        margin-left: -24px;
        margin-right: -24px;
        padding-left: 24px;
        padding-right: 24px;
    }
}

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

.photos img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    display: block;
}

.photo-item {
    position: relative;
}

.photo-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: var(--red);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.photo-remove:active {
    background: var(--red-dark);
}

.filebtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: var(--tap);
    border: 1px dashed var(--line);
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
}

.filebtn input {
    display: none;
}

.done {
    text-align: center;
    padding: 34px 20px;
}

.done .tick {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: #edf8f2;
    color: var(--ok);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    font-size: 32px;
}

.summary {
    text-align: left;
    background: var(--bg);
    border-radius: 10px;
    padding: 16px;
    margin: 22px 0;
    font-size: 15px;
}

.summary div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 5px 0;
}

.summary span:first-child {
    color: var(--muted);
}

.summary span:last-child {
    font-weight: 600;
    text-align: right;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 720px;
}

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

th {
    background: #fafbfc;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 700;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:active {
    background: var(--red-soft);
}

.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.tag-open {
    background: #fff4e5;
    color: #9a5b00;
}

.tag-done {
    background: #edf8f2;
    color: var(--ok);
}

.searchbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.searchbar input {
    flex: 1;
}

.dl {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    font-size: 15px;
}

@media (min-width: 620px) {
    .dl {
        grid-template-columns: 190px 1fr;
        gap: 10px 20px;
    }
}

.dl dt {
    color: var(--muted);
    font-size: 14px;
}

.dl dd {
    margin: 0 0 12px;
    font-weight: 600;
}

@media (min-width: 620px) {
    .dl dd {
        margin-bottom: 0;
    }
}

.sig-shown {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.sig-shown img {
    width: 100%;
    max-width: 300px;
    display: block;
}

.footer-note {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 24px 16px 32px;
    line-height: 1.7;
}

.login {
    max-width: 380px;
    margin: 8vh auto;
    padding: 0 16px;
}
