:root {
    --navy-950: #071225;
    --navy-900: #0b1f3b;
    --navy-800: #102a4c;
    --navy-700: #1c3d66;
    --ink: #0f172a;
    --muted: #64748b;
    --paper: #f6f8fc;
    --card: #ffffff;
    --gold: #d4a853;
    --gold-soft: #f5e6c5;
    --mint: #10b981;
    --mint-soft: #d1fae5;
    --sky: #38bdf8;
    --radius-lg: 22px;
    --radius-md: 14px;
    --shadow: 0 22px 50px rgba(7, 18, 37, 0.14);
    --shadow-sm: 0 10px 28px rgba(7, 18, 37, 0.1);
    --font: "DM Sans", system-ui, sans-serif;
    --font-display: "Outfit", var(--font);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.app-body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(56, 189, 248, 0.18), transparent),
        radial-gradient(900px 500px at 100% 0%, rgba(212, 168, 83, 0.2), transparent),
        linear-gradient(180deg, #eef2ff 0%, var(--paper) 38%, #e0f2fe 100%);
}

a {
    color: inherit;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-top));
    background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
    color: #f8fafc;
    box-shadow: 0 12px 30px rgba(7, 18, 37, 0.35);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.03em;
}

.app-brand-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--gold), #b8892e);
    color: var(--navy-950);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 800;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.app-avatar-chip {
    text-decoration: none;
}

.app-avatar-initial {
    display: inline-flex;
    width: 2.1rem;
    height: 2.1rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.15);
    border: 1px solid rgba(248, 250, 252, 0.25);
    font-weight: 700;
    font-size: 0.95rem;
}

.app-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem 1rem calc(5.5rem + env(safe-area-inset-bottom));
}

.app-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    padding: 0.35rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 -14px 40px rgba(15, 23, 42, 0.08);
}

.bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    border-radius: 14px;
    transition: color 0.15s ease, background 0.15s ease;
}

.bn-item.active {
    color: var(--navy-900);
    background: rgba(16, 185, 129, 0.12);
}

.bn-ic {
    font-size: 1.25rem;
    line-height: 1;
}

.bn-ic-dot {
    position: relative;
}

.bn-ic-dot::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -4px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--mint);
    box-shadow: 0 0 0 2px #fff;
}

.hero-card {
    background: linear-gradient(145deg, var(--navy-900), #0f3460);
    color: #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: "";
    position: absolute;
    inset: -40% -20% auto auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.35), transparent 65%);
    pointer-events: none;
}

.hero-card h1 {
    margin: 0 0 0.5rem;
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    line-height: 1.2;
    position: relative;
}

.hero-card p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.92rem;
    line-height: 1.55;
    position: relative;
}

.card {
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.15rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(148, 163, 184, 0.22);
    margin-bottom: 1rem;
}

.card h2,
.card h3 {
    font-family: var(--font-display);
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}

.muted {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.tile-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.85rem 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
    background: #fff;
    text-align: left;
    text-decoration: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.tile-btn:hover {
    border-color: #94a3b8;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.tile-btn strong {
    font-size: 0.92rem;
}

.tile-btn span.ic {
    font-size: 1.35rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    border-radius: 12px;
    border: none;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--navy-800), var(--navy-900));
    color: #f8fafc;
    box-shadow: 0 14px 30px rgba(11, 31, 59, 0.35);
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-secondary {
    background: #fff;
    color: var(--navy-900);
    border: 2px solid var(--navy-800);
}

.btn-ghost-light {
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    border: 1px solid rgba(248, 250, 252, 0.35);
    text-decoration: none;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-sm {
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-gold {
    background: var(--gold-soft);
    color: #7c5e12;
    border: 1px solid rgba(212, 168, 83, 0.45);
}

.badge-mint {
    background: var(--mint-soft);
    color: #065f46;
}

.score-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.15);
    color: #065f46;
    font-weight: 700;
    font-size: 0.88rem;
}

.listing-grid {
    display: grid;
    gap: 1rem;
}

.listing-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.listing-card .ph {
    height: 160px;
    background: linear-gradient(120deg, #cbd5e1, #e2e8f0 40%, #bae6fd);
    position: relative;
}

.listing-card img.cover {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.listing-card .body {
    padding: 1rem 1.05rem 1.1rem;
}

.price {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--navy-900);
}

.tag-zone {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    color: #fff;
}

.zone-hijau {
    background: #059669;
}

.zone-kuning {
    background: #ca8a04;
}

.zone-merah {
    background: #dc2626;
}

.auth-shell {
    min-height: calc(100dvh - 52px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: calc(var(--radius-lg) + 4px);
    padding: 1.75rem 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.auth-card h1 {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-size: 1.55rem;
    color: var(--navy-900);
}

.auth-tabs {
    display: flex;
    gap: 0.35rem;
    margin: 1rem 0 1.25rem;
    padding: 0.25rem;
    background: #f1f5f9;
    border-radius: 999px;
}

.auth-tabs a {
    flex: 1;
    text-align: center;
    padding: 0.45rem 0.5rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: #64748b;
}

.auth-tabs a.active {
    background: #fff;
    color: var(--navy-900);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.field {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
}

.field span.label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
}

.field input,
.field select,
.field textarea {
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    padding: 0.65rem 0.75rem;
    font: inherit;
    background: #f8fafc;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: 2px solid rgba(56, 189, 248, 0.45);
    border-color: #38bdf8;
    background: #fff;
}

.alert {
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    font-size: 0.88rem;
    margin-bottom: 0.85rem;
}

.alert-err {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-ok {
    background: #ecfdf5;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-warn {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.split-google {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    color: #94a3b8;
    font-size: 0.78rem;
}

.split-google::before,
.split-google::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.map-frame {
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 320px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.map-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.floating-score {
    float: right;
    width: min(46%, 200px);
    margin: 0 0 0.5rem 0.75rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-md);
    background: linear-gradient(160deg, #ecfdf5, #d1fae5);
    border: 1px solid #6ee7b7;
    font-size: 0.78rem;
}

.floating-score strong {
    display: block;
    font-size: 1.15rem;
    color: #065f46;
    font-family: var(--font-display);
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 0.65rem;
    margin-top: 0.75rem;
    font-size: 0.82rem;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #166534;
    font-weight: 600;
}

/* Aturan dasar balon chat */
.chat-bubble {
    padding: 0.7rem 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
    max-width: auto; /* Batasi agar tidak penuh layar */
    width: fit-content; /* Kunci: lebar mengikuti teks */
}

/* Posisi Kanan (User) */
.chat-me {
    background: var(--navy-800);
    color: #ffffff;
    align-self: flex-end; /* Paksa balon ke kanan */
    border-bottom-right-radius: 4px;
}
/* Posisi Kiri (Admin/Notaris) */
.chat-them {
    background: #e2e8f0;
    color: #0f172a;
    align-self: flex-start; /* Paksa balon ke kiri */
    border-bottom-left-radius: 4px;
}
.chat-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overflow-y: auto;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.escrow-step {
    display: flex;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
    background: #fff;
}

.escrow-step.done {
    border-color: #6ee7b7;
    background: #f0fdf4;
}

.step-idx {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    background: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.escrow-step.done .step-idx {
    background: #22c55e;
    color: #fff;
}

.locked-blur {
    filter: blur(7px);
    user-select: none;
    pointer-events: none;
    max-height: 120px;
    overflow: hidden;
}

@media (min-width: 900px) {
    .app-main {
        max-width: 960px;
    }
}

@media print {
    @page {
        margin: 0;
    }
    body {
        padding: 2cm 1.5cm !important;
        background-color: #ffffff !important;
    }
    .no-print {
        display: none !important;
    }

    /* === TAMBAHKAN KODE BARU INI === */
    .page-break {
        break-before: page !important;       /* Standar modern */
        page-break-before: always !important; /* Dukungan browser lama / PDF engine */
    }
}
/* ==========================================================================
   PENGATURAN & MODAL STYLES (Dari profile.php)
   ========================================================================== */
.tile-btn-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.85rem 0.5rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.tile-btn-action:hover {
    background: #f8fafc;
    border-color: var(--navy-800, #0f172a);
    transform: translateY(-1px);
}

.tile-btn-action .ic {
    font-size: 1.6rem;
    margin-bottom: 4px;
}

.tile-btn-action strong {
    font-size: 0.85rem;
    color: var(--navy-900, #0f172a);
    display: block;
}

.tile-btn-action small {
    font-size: 0.68rem;
    color: #64748b;
    margin-top: 2px;
}

/* Modal Core Layout */
.custom-modal-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.custom-modal-content {
    background: #ffffff;
    padding: 1.25rem;
    border-radius: 14px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    animation: modalAnimIn 0.2s ease-out;
}

@keyframes modalAnimIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.btn-cancel {
    background: #f1f5f9; border: none; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.8rem; color: #475569; cursor: pointer;
}

.btn-submit-save {
    background: var(--navy-800, #0f172a); border: none; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.8rem; color: #ffffff; cursor: pointer; font-weight: 500;
}

.chat-target-item {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    background: #ffffff;
    transition: all 0.2s ease;
}
.chat-target-item:hover {
background-color: #f1f5f9;
}
.chat-target-item.active {
    background: var(--navy-800) !important;
    color: #ffffff !important;
    border-color: var(--navy-800) !important;
}
.chat-target-item.active small {
    color: #cbd5e1 !important;
}
/* Gaya Balon Chat Preview (System Message) */
.system-chat-bubble {
    background: #f1f5f9; /* Warna abu-abu muda */
    border: 1px solid #e2e8f0;
    border-radius: 15px 15px 15px 0;
    padding: 12px;
    margin: 10px 0;
    max-width: 85%;
    font-size: 0.9rem;
    color: #475569;
    align-self: flex-start;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.system-chat-bubble strong {
    color: #1e293b;
    display: block;
    margin-bottom: 4px;
}

.preview-price {
    font-weight: bold;
    color: #059669; /* Hijau untuk harga */
}