:root {
    --primary: #2563eb;
    --accent: #16a34a;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #111827;
    --muted: #64748b;
    --line: #e2e8f0;
    --danger: #dc2626;
    --warning: #f97316;
    --success: #16a34a;
    --shadow: 0 16px 45px rgba(15, 23, 42, .10);
    --card-radius: 8px;
    --font-scale: 1;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--app-font, "Aptos", "Aptos Display", "Segoe UI Variable", "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif);
    font-size: calc(15px * var(--font-scale));
    letter-spacing: 0;
    overscroll-behavior: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .28s ease, transform .28s ease;
}

body.page-ready {
    opacity: 1;
    transform: translateY(0);
}

body,
input,
select,
textarea,
button {
    font: inherit;
    letter-spacing: 0;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 9px 11px;
    font-size: 16px;
    outline: none;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

input.is-dirty,
select.is-dirty,
textarea.is-dirty {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}

a {
    color: inherit;
}

button,
a.btn,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 0 14px;
    text-decoration: none;
    font-weight: 750;
    cursor: pointer;
    white-space: nowrap;
}

.btn.primary,
button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

button,
.btn,
.panel,
.record,
.crm-card,
.development-card,
.analytics-card,
.metric,
input,
select,
textarea {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease, color .18s ease, opacity .18s ease;
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .10);
}

form.is-submitting {
    pointer-events: none;
    opacity: .72;
}

.icon-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    border-radius: 8px;
    padding: 0;
    font-size: 24px;
    line-height: 1;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px;
    background: #111827;
    color: #e5e7eb;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    color: #fff;
    text-decoration: none;
}

.brand img,
.brand span,
.round-logo {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: #fff;
    color: #111827;
    overflow: hidden;
    font-weight: 850;
}

.brand img,
.round-logo img {
    object-fit: cover;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    min-height: 42px;
    border-radius: 8px;
    padding: 0 10px;
    color: #cbd5e1;
    text-decoration: none;
}

.nav a.active,
.nav a:hover {
    background: rgba(255, 255, 255, .10);
    color: #fff;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    font-size: 10px;
    text-transform: uppercase;
    overflow: hidden;
}

.logout {
    margin-top: auto;
    color: #fca5a5;
    text-decoration: none;
    font-weight: 800;
}

.main {
    min-width: 0;
    padding: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.topbar h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.12;
}

.topbar p {
    margin: 6px 0 0;
    color: var(--muted);
}

.flash {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.flash.error {
    border-color: #fecaca;
    background: #fff1f2;
    color: #991b1b;
}

.panel,
.record,
.metric,
.development-card,
.kanban-column {
    border: 1px solid var(--line);
    border-radius: var(--card-radius);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.panel {
    padding: 18px;
    margin-bottom: 16px;
}

.panel h2 {
    margin: 0 0 16px;
    font-size: 19px;
}

summary {
    cursor: pointer;
    font-weight: 850;
}

details[open] summary {
    margin-bottom: 16px;
}

.form-grid,
.filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.form-grid label,
.filters label,
.stack label,
.template-form label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-weight: 750;
}

.full {
    grid-column: 1 / -1;
}

.check {
    display: inline-flex !important;
    grid-auto-flow: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px !important;
    min-height: 42px;
}

.check input {
    width: 18px;
    min-height: 18px;
}

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

.metric {
    padding: 18px;
    display: grid;
    gap: 8px;
}

.metric span,
.metric small {
    color: var(--muted);
}

.metric strong {
    font-size: 28px;
    line-height: 1;
}

.metric a {
    color: var(--primary);
    font-weight: 800;
    text-decoration: none;
}

.status-available {
    border-top: 4px solid var(--success);
}

.status-reserved {
    border-top: 4px solid var(--warning);
}

.status-sold {
    border-top: 4px solid var(--danger);
}

.kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(252px, 1fr);
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
}

.kanban-column {
    min-height: 420px;
    background: #f8fafc;
}

.kanban-column header {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

.kanban-column header strong {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.status-icon {
    max-width: 58px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--column-color, var(--primary));
}

.kanban-list {
    display: grid;
    gap: 7px;
    padding: 9px;
    align-content: start;
    min-height: 330px;
}

.crm-card {
    display: grid;
    gap: 3px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--column-color, var(--primary));
    border-radius: 8px;
    background: #fff;
    padding: 8px 9px;
    cursor: grab;
    min-height: 50px;
}

.crm-card:active {
    cursor: grabbing;
}

.crm-card strong {
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-card span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .09);
}

.crm-info-list dd {
    overflow-wrap: anywhere;
}

.crm-move-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.crm-move-form label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-weight: 800;
}

.muted {
    color: var(--muted);
    line-height: 1.5;
}

.development-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.development-card {
    background: var(--dev-color, #fff);
    padding: 14px;
    display: grid;
    gap: 12px;
}

.development-card a:first-child {
    display: grid;
    grid-template-columns: 50px 1fr;
    gap: 12px;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

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

.mini-link {
    color: var(--primary);
    font-weight: 800;
    text-decoration: none;
}

.map-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.legend {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
}

.legend i {
    width: 14px;
    height: 14px;
    border-radius: 999px;
}

.legend .available {
    background: var(--success);
}

.legend .reserved {
    background: var(--warning);
}

.legend .sold {
    background: var(--danger);
}

.map-shell {
    position: relative;
    width: 100%;
    height: calc(100vh - 150px);
    min-height: 520px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f172a;
    touch-action: none;
    user-select: none;
    box-shadow: var(--shadow);
}

.map-stage {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.map-stage img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.lot-marker {
    position: absolute;
    min-width: 22px;
    min-height: 22px;
    border: 2px solid #fff;
    border-radius: 999px;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
    padding: 0;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, .25);
    overflow: hidden;
}

.lot-available {
    background: var(--success);
}

.lot-reserved {
    background: var(--warning);
}

.lot-sold {
    background: var(--danger);
}

.map-shell.editing {
    outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
}

.modal {
    width: min(760px, calc(100vw - 24px));
    border: 0;
    border-radius: 8px;
    padding: 0;
    box-shadow: var(--shadow);
}

.modal::backdrop {
    background: rgba(15, 23, 42, .55);
}

.modal-body {
    padding: 18px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    grid-column: 1 / -1;
    margin-bottom: 2px;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.info-list {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    margin: 0 0 16px;
}

.info-list dt {
    color: var(--muted);
    font-weight: 800;
}

.info-list dd {
    margin: 0;
}

.records {
    display: grid;
    gap: 12px;
}

.record {
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 14px;
    align-items: center;
}

.record > div:first-child {
    display: grid;
    gap: 5px;
}

.record span,
.record small {
    color: var(--muted);
}

.record-values {
    display: grid;
    justify-items: end;
    gap: 6px;
}

.record-values .positive {
    color: var(--success);
}

.record-values .negative {
    color: var(--danger);
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-form select {
    width: 200px;
}

.contract-record {
    grid-template-columns: 1fr;
}

.contract-record pre {
    margin: 6px 0 0;
    padding: 14px;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.embedded-doc {
    margin-top: 8px;
}

.embedded-doc summary {
    color: var(--primary);
    font-size: 13px;
}

.embedded-doc pre {
    margin: 8px 0 0;
    padding: 12px;
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
}

.settings-list,
.template-grid {
    display: grid;
    gap: 12px;
}

.line-form {
    display: grid;
    grid-template-columns: minmax(140px, 1.2fr) 100px 80px 80px 110px 90px auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}

.template-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.template-form {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface-2);
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

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

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 18px;
    background: #eef2f7;
}

.login-card {
    width: min(430px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 24px;
    box-shadow: var(--shadow);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.login-brand span {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
}

.login-brand h1 {
    margin: 0;
    font-size: 25px;
}

.login-brand p {
    margin: 4px 0 0;
    color: var(--muted);
}

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

.blink,
.blink-marker,
.blink-soft {
    animation: imobzBlink 1.2s ease-in-out infinite;
}

.blink-soft {
    animation-duration: 1.8s;
}

@keyframes imobzBlink {
    0%, 100% { filter: brightness(1); box-shadow: 0 0 0 0 rgba(249, 115, 22, .34); }
    50% { filter: brightness(1.18); box-shadow: 0 0 0 8px rgba(249, 115, 22, 0); }
}

/* Professional dashboard refresh */
.ui-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

body {
    background:
        linear-gradient(180deg, #eef4fb 0, #f7f9fc 38%, #f4f7fb 100%);
}

.sidebar {
    background: linear-gradient(180deg, #0a1020 0, #111827 48%, #182033 100%);
    border-right: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 18px 0 48px rgba(15, 23, 42, .15);
}

.brand {
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
}

.brand img,
.brand span {
    box-shadow: 0 10px 28px rgba(37, 99, 235, .22);
}

.brand strong {
    font-size: 18px;
}

.nav {
    gap: 8px;
}

.nav a {
    position: relative;
    min-height: 46px;
    border: 1px solid transparent;
    color: #aebbd0;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.nav a:hover {
    transform: translateX(2px);
}

.nav a.active,
.nav a:hover {
    background: rgba(255, 255, 255, .09);
    border-color: rgba(255, 255, 255, .10);
}

.nav a.active::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 9px;
    width: 3px;
    height: calc(100% - 18px);
    border-radius: 999px;
    background: var(--accent);
}

.nav-icon {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, .08);
    color: #dbeafe;
    font-size: 0;
}

.nav a.active .nav-icon {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .35);
}

.logout {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 0 10px;
    border-radius: 8px;
    color: #fecaca;
}

.logout:hover {
    background: rgba(239, 68, 68, .12);
}

.main {
    padding: 28px;
}

.topbar {
    align-items: center;
    padding: 18px 20px;
    border: 1px solid rgba(226, 232, 240, .85);
    border-radius: 8px;
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 18px 55px rgba(15, 23, 42, .08);
    backdrop-filter: blur(16px);
}

.page-kicker,
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.topbar h1 {
    margin-top: 4px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 190px;
    justify-content: flex-end;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #111827;
    color: #fff;
    font-weight: 900;
}

.topbar-user strong,
.topbar-user small {
    display: block;
}

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

.install-app-btn {
    min-height: 38px;
    border: 1px solid rgba(37, 99, 235, .18);
    background: color-mix(in srgb, var(--primary) 9%, #fff);
    color: var(--primary);
}

.install-app-btn[hidden] {
    display: none;
}

.install-guide {
    display: grid;
    gap: 9px;
}

.install-guide p {
    margin: 0 0 4px;
    color: var(--muted);
    line-height: 1.45;
}

.install-guide small {
    display: block;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
}

.panel,
.record,
.metric,
.development-card,
.kanban-column,
.analytics-card,
.dashboard-hero,
.page-actions {
    border-color: rgba(203, 213, 225, .72);
    box-shadow: 0 18px 50px rgba(15, 23, 42, .07);
}

.filter-panel {
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(14px);
}

.filter-panel .filters {
    align-items: end;
}

label.has-file {
    color: var(--primary);
}

label.has-file input[type="file"] {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 6%, #fff);
}

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, .38);
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(7px);
    transition: opacity .18s ease, visibility .18s ease;
}

.app-loader.active {
    opacity: 1;
    visibility: visible;
}

.app-loader > div {
    width: min(320px, calc(100vw - 36px));
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 8px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 28px 70px rgba(15, 23, 42, .25);
}

.app-loader strong {
    font-size: 17px;
}

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

.loader-ring {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 4px solid #dbeafe;
    border-top-color: var(--primary);
    animation: spin .75s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
    align-items: stretch;
    padding: 22px;
    margin-bottom: 18px;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(239, 246, 255, .92)),
        #fff;
}

.dashboard-hero h2 {
    margin: 9px 0 8px;
    font-size: 31px;
    line-height: 1.08;
}

.dashboard-hero p {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.hero-card {
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 18px;
    border: 1px solid rgba(37, 99, 235, .16);
    border-radius: 8px;
    background: #0f172a;
    color: #fff;
}

.hero-card span,
.hero-card small {
    color: #cbd5e1;
}

.hero-card strong {
    font-size: 27px;
}

.metric.pro {
    grid-template-columns: 52px 1fr;
    align-items: center;
    min-height: 128px;
    padding: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 250, 252, .98)),
        #fff;
}

.metric.pro > div {
    display: grid;
    gap: 6px;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--primary) 12%, #fff);
    color: var(--primary);
}

.metric-icon.success {
    background: #dcfce7;
    color: var(--success);
}

.metric-icon.warning {
    background: #ffedd5;
    color: var(--warning);
}

.metric-icon.danger {
    background: #fee2e2;
    color: var(--danger);
}

.metric-icon.accent {
    background: #ccfbf1;
    color: #0f766e;
}

.metric-icon .ui-icon {
    width: 23px;
    height: 23px;
}

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

.analytics-card {
    padding: 18px;
    border: 1px solid rgba(203, 213, 225, .72);
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
}

.analytics-card.span-2 {
    grid-column: span 2;
}

.analytics-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.analytics-card h3 {
    margin: 4px 0 0;
    font-size: 19px;
}

.funnel-chart {
    display: grid;
    gap: 13px;
}

.funnel-row {
    display: grid;
    grid-template-columns: minmax(116px, .8fr) minmax(120px, 1fr) 36px;
    gap: 10px;
    align-items: center;
}

.funnel-row span {
    color: #475569;
    font-weight: 750;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    height: 10px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.bar-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--bar-color, var(--primary));
}

.donut-wrap {
    position: relative;
    width: 190px;
    height: 190px;
    margin: 2px auto 18px;
}

.donut {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: conic-gradient(var(--success) 0 var(--available), var(--warning) var(--available) var(--reserved), var(--danger) var(--reserved) 100%);
    box-shadow: inset 0 0 0 18px #fff, 0 18px 50px rgba(15, 23, 42, .12);
}

.donut-center {
    position: absolute;
    inset: 48px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    align-content: center;
    background: #fff;
    box-shadow: 0 0 0 1px var(--line);
}

.donut-center strong {
    font-size: 28px;
    line-height: 1;
}

.donut-center span {
    color: var(--muted);
    font-size: 12px;
}

.legend-list,
.status-pills {
    display: grid;
    gap: 10px;
}

.legend-list span,
.status-pills span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    font-weight: 750;
}

.legend-list i {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-right: auto;
}

.legend-list .available { background: var(--success); }
.legend-list .reserved { background: var(--warning); }
.legend-list .sold { background: var(--danger); }

.money-bars {
    height: 228px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    align-items: end;
}

.money-bars div {
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 8px;
    align-items: end;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.money-bars i {
    width: 100%;
    min-height: 8px;
    border-radius: 8px 8px 3px 3px;
}

.money-bars .paid { background: var(--success); }
.money-bars .pending { background: var(--warning); }
.money-bars .overdue { background: var(--danger); }

.money-bars strong {
    color: var(--text);
    font-size: 12px;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid rgba(203, 213, 225, .72);
    border-radius: 8px;
    background: rgba(255, 255, 255, .82);
}

.btn .ui-icon,
button .ui-icon,
a .ui-icon {
    width: 17px;
    height: 17px;
}

.map-toolbar {
    padding: 10px;
    border: 1px solid rgba(203, 213, 225, .72);
    border-radius: 8px;
    background: rgba(255, 255, 255, .84);
    box-shadow: 0 14px 38px rgba(15, 23, 42, .06);
}

.map-shell {
    background: #060913;
    border-color: rgba(15, 23, 42, .18);
}

.map-hud {
    position: absolute;
    z-index: 5;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    pointer-events: none;
}

.map-hud span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, .72);
    color: #e5e7eb;
    font-size: 12px;
    font-weight: 800;
    backdrop-filter: blur(10px);
}

.map-hud [data-edit-hint].active {
    background: rgba(22, 163, 74, .90);
    color: #fff;
}

.lot-marker {
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.lot-marker:hover {
    transform: scale(1.08);
    z-index: 4;
}

.map-shell.editing .lot-marker {
    cursor: move;
}

.lot-marker.dragging-lot {
    z-index: 8;
    transform: scale(1.18);
    filter: brightness(1.1);
    box-shadow: 0 0 0 5px rgba(255, 255, 255, .42), 0 20px 40px rgba(15, 23, 42, .30);
}

.lot-marker.saving {
    opacity: .72;
}

.modal {
    background: #fff;
}

.modal-header {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.record {
    background: rgba(255, 255, 255, .92);
}

.record:hover,
.development-card:hover,
.kanban-column:hover,
.analytics-card:hover,
.metric.pro:hover {
    border-color: color-mix(in srgb, var(--primary) 24%, var(--line));
}

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

    .sidebar {
        position: sticky;
        z-index: 10;
        height: auto;
        top: 0;
        padding: 10px;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .brand strong,
    .logout {
        display: none;
    }

    .nav {
        display: flex;
        gap: 6px;
    }

    .nav a {
        grid-template-columns: 1fr;
        justify-items: center;
        min-width: 74px;
        padding: 6px;
        font-size: 12px;
    }

    .nav-icon {
        display: none;
    }

    .main {
        padding: 16px;
    }

    .topbar {
        align-items: flex-start;
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
    }

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

    .analytics-card.span-2 {
        grid-column: span 2;
    }

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

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

    .record {
        grid-template-columns: 1fr;
    }

    .record-values {
        justify-items: start;
    }

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

    .map-shell {
        height: calc(100vh - 138px);
        min-height: 420px;
    }
}

@media (max-width: 680px) {
    .topbar h1 {
        font-size: 23px;
    }

    .topbar {
        display: grid;
    }

    .topbar-user {
        justify-content: flex-start;
        min-width: 0;
    }

    .dashboard-hero h2 {
        font-size: 25px;
    }

    .dashboard-grid,
    .analytics-card.span-2 {
        grid-template-columns: 1fr;
        grid-column: auto;
    }

    .funnel-row {
        grid-template-columns: 1fr 42px;
    }

    .funnel-row .bar-track {
        grid-column: 1 / -1;
        order: 3;
    }

    .form-grid,
    .filters,
    .metrics-grid,
    .template-form {
        grid-template-columns: 1fr;
    }

    .kanban {
        grid-auto-columns: 82vw;
    }

    .map-toolbar .legend {
        font-size: 13px;
    }

    .modal-body {
        padding: 14px;
    }

    .info-list {
        grid-template-columns: 1fr;
    }

    .inline-form {
        display: grid;
        width: 100%;
    }

    .inline-form select {
        width: 100%;
    }

    .crm-move-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .app-shell {
        display: block;
        min-height: 100vh;
    }

    .sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        z-index: 80;
        height: calc(74px + env(safe-area-inset-bottom));
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
        display: block;
        overflow: visible;
        background: rgba(255, 255, 255, .92);
        border-top: 1px solid rgba(203, 213, 225, .86);
        border-right: 0;
        box-shadow: 0 -18px 45px rgba(15, 23, 42, .14);
        backdrop-filter: blur(18px);
    }

    .brand,
    .logout {
        display: none;
    }

    .nav {
        height: 100%;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        scrollbar-width: none;
        padding: 0 2px;
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    .nav a {
        min-width: 76px;
        height: 58px;
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 28px 18px;
        justify-items: center;
        align-content: center;
        gap: 3px;
        padding: 5px 8px;
        border-radius: 8px;
        color: #64748b;
        font-size: 11px;
        font-weight: 850;
        white-space: nowrap;
    }

    .nav a.active,
    .nav a:hover {
        background: color-mix(in srgb, var(--primary) 10%, #fff);
        border-color: color-mix(in srgb, var(--primary) 20%, #fff);
        color: var(--primary);
        transform: none;
    }

    .nav a.active::before {
        display: none;
    }

    .nav-icon {
        display: grid;
        width: 28px;
        height: 28px;
        background: #eef2ff;
        color: var(--primary);
    }

    .nav a.active .nav-icon {
        background: var(--primary);
        color: #fff;
        box-shadow: 0 8px 18px rgba(37, 99, 235, .28);
    }

    .main {
        padding: 14px 14px calc(92px + env(safe-area-inset-bottom));
    }

    .topbar {
        padding: 14px;
        margin-bottom: 14px;
        border-radius: 8px;
    }

    .topbar-user {
        width: 100%;
        justify-content: space-between;
    }

    .install-app-btn {
        order: 3;
        width: 100%;
    }
}

@media (max-width: 760px) {
    body[data-page="development"] {
        background: #060913;
    }

    body[data-page="development"] .main {
        padding: 0;
    }

    body[data-page="development"] .topbar {
        display: none;
    }

    body[data-page="development"] .flash {
        position: fixed;
        z-index: 90;
        left: 10px;
        right: 10px;
        top: 10px;
    }

    body[data-page="development"] .map-toolbar {
        position: fixed;
        z-index: 30;
        top: calc(10px + env(safe-area-inset-top));
        left: 10px;
        right: 10px;
        margin: 0;
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    body[data-page="development"] .map-shell {
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    body[data-page="development"] .map-hud {
        top: calc(68px + env(safe-area-inset-top));
    }
}

@media (display-mode: standalone) and (max-width: 760px) {
    body[data-page="development"] .sidebar {
        display: none;
    }

    body[data-page="development"] .map-shell {
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
    }
}
