:root {
    --primary: #1590C2;
    --primary-dark: #0d6a93;
    --secondary: #667eea;
    --accent: #764ba2;
    --success: #10b981;
    --dark: #1e293b;
    --light: #f8fafc;
    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--light);
    color: var(--dark);
}

a {
    text-decoration: none;
}

/* ---------- Auth (login) split panel ---------- */
.login-wrapper {
    display: flex;
    min-height: 100vh;
}

.brand-panel {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--dark) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.brand-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
}

.brand-content {
    position: relative;
    z-index: 1;
    max-width: 500px;
}

.brand-logo {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
}

.brand-logo i {
    font-size: 44px;
    margin-right: 15px;
}

.brand-logo h1 {
    font-size: 30px;
    font-weight: 700;
    margin: 0;
}

.brand-logo span {
    font-size: 13px;
    opacity: .8;
    display: block;
}

.brand-tagline {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 20px;
}

.brand-tagline span {
    background: linear-gradient(135deg, #ffd700 0%, #ff9500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-description {
    font-size: 16px;
    line-height: 1.7;
    opacity: .9;
    margin-bottom: 30px;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-list li i {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, .15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
}

.login-panel {
    flex: 0 0 480px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    background: #fff;
}

.login-form-container {
    max-width: 360px;
    margin: 0 auto;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    font-weight: 700;
}

.login-header p {
    color: #64748b;
}

.form-control, .form-select {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    background: #f8fafc;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(21, 144, 194, .1);
    background: #fff;
}

.btn-brand {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    transition: all .2s ease;
}

.btn-brand:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(21, 144, 194, .3);
}

@media (max-width: 1024px) {
    .brand-panel { display: none; }
    .login-panel { flex: 1; }
}

/* ---------- App shell (sidebar + topbar) ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--dark) 0%, #0f172a 100%);
    color: #cbd5e1;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar .brand i {
    color: var(--primary);
}

.sidebar .nav-section {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .06em;
    color: #64748b;
    padding: 16px 20px 6px;
}

.sidebar .nav-link {
    color: #cbd5e1;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14.5px;
    border-left: 3px solid transparent;
}

.sidebar .nav-link i {
    width: 18px;
    text-align: center;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .05);
    color: #fff;
}

.sidebar .nav-link.active {
    background: rgba(21, 144, 194, .18);
    color: #fff;
    border-left-color: var(--primary);
}

.main-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar .user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar .user-chip .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.content {
    padding: 24px;
    flex: 1;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
    text-decoration: none;
    margin-bottom: 6px;
}
.back-link:hover { color: var(--primary); }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}

.card {
    border: 1px solid #eef1f5;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eef1f5;
    border-radius: 14px 14px 0 0 !important;
    font-weight: 600;
}

.stat-tile {
    border-radius: 14px;
    padding: 20px;
    background: #fff;
    border: 1px solid #eef1f5;
}

.stat-tile .stat-value {
    font-size: 26px;
    font-weight: 700;
}

.stat-tile .stat-label {
    color: #64748b;
    font-size: 13px;
}

.stat-tile .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}

.table thead th {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .04em;
    color: #64748b;
    border-bottom-width: 1px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.badge {
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 8px;
}

.plot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
}

.plot-cell {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    border: none;
}

.map-canvas {
    position: relative;
    display: block;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    line-height: 0;
}
.map-canvas img {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
}
.map-marker {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .5);
    transform: translate(-50%, -50%);
    padding: 0;
    z-index: 2;
}
.map-marker:hover { transform: translate(-50%, -50%) scale(1.25); }

.plot-AVAILABLE { background: var(--success); }
.plot-HELD { background: #94a3b8; }
.plot-RESERVED { background: #f59e0b; }
.plot-SOLD { background: var(--primary); }
.plot-PAYMENT_DEFAULT { background: #dc2626; }
.plot-CANCELLED { background: #475569; }
.plot-TRANSFER_PENDING { background: #764ba2; }
.plot-TRANSFERRED { background: #0d6a93; }

.lifecycle-steps { list-style: none; padding: 0; margin: 0; }
.lifecycle-steps li {
    display: flex;
    gap: 12px;
    padding-bottom: 22px;
    position: relative;
}
.lifecycle-steps li:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 26px;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}
.lifecycle-steps .dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    color: #fff;
    background: #cbd5e1;
}
.lifecycle-steps li.done .dot { background: var(--success); }
.lifecycle-steps li.current .dot { background: var(--primary); }

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; z-index: 50; }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
}

/* ---------- White-label letterhead (printed documents & print-mode pages) ---------- */
.letterhead {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 18px;
    margin-bottom: 24px;
}
.letterhead img { height: 56px; width: auto; max-width: 200px; object-fit: contain; flex-shrink: 0; }
.letterhead .lh-name { font-size: 21px; font-weight: 700; }
.letterhead .lh-meta { font-size: 12.5px; color: #64748b; }
.letterhead .lh-tax { font-size: 11px; color: #94a3b8; }

.print-only { display: none; }

@media print {
    .sidebar, .topbar, .nav-toggle, .no-print { display: none !important; }
    .main-area { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    .print-only { display: block; }
    .card { box-shadow: none !important; }
}

/* ---------- Simple report bar charts ---------- */
.bar-row {
    display: grid;
    grid-template-columns: 110px 1fr 100px;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 8px;
}
.bar-row .bar-label { color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: #eef1f5; border-radius: 6px; height: 16px; overflow: hidden; }
.bar-fill { background: var(--primary); height: 100%; border-radius: 6px; }
.bar-fill.secondary { background: var(--secondary); }
.bar-row .bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
