:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1c2430;
    --muted: #6b7280;
    --border: #dfe5eb;
    --accent: #0f62fe;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
.app-header {
    padding: 14px 16px;
    background: #111827;
    color: #fff;
    position: sticky;
    top: 0;
}
.brand { font-weight: 700; margin-bottom: 8px; }
.top-nav { display: flex; gap: 12px; flex-wrap: wrap; }
.top-nav a { color: #dbeafe; text-decoration: none; font-size: 14px; }
.page-content { padding: 16px; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, .05);
}
.muted { color: var(--muted); }
.grid-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.tile {
    display: block;
    padding: 16px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fafafa;
}
.form-grid { display: grid; gap: 12px; }
label span { display: block; margin-bottom: 6px; font-size: 14px; }
input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
}
button {
    padding: 12px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}
.result-box {
    margin-top: 12px;
    background: #0b1020;
    color: #d1fae5;
    padding: 12px;
    border-radius: 12px;
    overflow: auto;
}

.page-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.button-link, .primary-btn, .secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}
.button-link, .primary-btn {
    background: var(--accent);
    color: #fff;
}
.secondary-btn {
    background: #eef2ff;
    color: #243b82;
    border: 1px solid #c7d2fe;
}
.header-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
    padding: 8px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #243b82;
    font-size: 12px;
    font-weight: 700;
}
.object-form { display: grid; gap: 14px; padding-bottom: 160px; }
.accordion-toggle {
    width: 100%;
    background: transparent;
    color: var(--text);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.accordion-toggle span { text-align: left; }
.accordion-toggle small { display: block; color: var(--muted); margin-top: 4px; }
.accordion-meta {
    min-width: 68px;
    text-align: right;
    color: var(--muted);
    font-size: 13px;
}
.accordion-content { display: none; margin-top: 14px; }
.accordion-content.is-open { display: block; }
.two-col {
    grid-template-columns: 1fr;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field.required span::after {
    content: " *";
    color: #dc2626;
}
.field select,
.field textarea,
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field input[type="datetime-local"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    font: inherit;
}
.field textarea { resize: vertical; min-height: 120px; }
.checkbox-field {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafafa;
}
.checkbox-field span::after { content: ""; }
.checkbox-field input { width: auto; }
.hidden { display: none !important; }
.full-width { grid-column: 1 / -1; }
.is-invalid input,
.is-invalid select,
.is-invalid textarea {
    border-color: #dc2626;
    background: #fef2f2;
}
.block-has-errors {
    border-color: #fecaca;
    box-shadow: 0 0 0 2px rgba(220,38,38,.08);
}
.block-complete {
    border-color: #bbf7d0;
}
.map-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: #f8fafc;
    margin-bottom: 14px;
}
#addressMap {
    height: 320px;
    width: 100%;
}
.map-help { padding: 10px 12px 14px; margin: 0; }
.sticky-progress {
    position: sticky;
    bottom: 12px;
    z-index: 15;
    border: 1px solid var(--border);
    box-shadow: 0 12px 32px rgba(17,24,39,.14);
}
.progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.progress-percent {
    font-size: 22px;
    font-weight: 800;
}
.progress-bar {
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 12px;
}
.progress-bar-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #10b981);
    transition: width .2s ease;
}
.sticky-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.photo-preview-grid {
    margin-top: 12px;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
}
.photo-preview-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.photo-preview-item img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}
.photo-preview-item div {
    padding: 6px 8px;
    font-size: 12px;
}
@media (min-width: 760px) {
    .two-col {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}
