/* ==========================================================================
   LandLord Pro - Executive PropTech UI Design System (Lagos Edition)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Theme Colors */
    --bg-base: #0b0f19;
    --bg-surface: #121827;
    --bg-surface-elevated: #1a2234;
    --bg-glass: rgba(22, 30, 49, 0.85);
    
    --primary: #10b981; /* Emerald Green - Nigerian Growth */
    --primary-glow: rgba(16, 185, 129, 0.25);
    --primary-hover: #059669;
    
    --accent: #6366f1; /* Indigo */
    --accent-cyan: #06b6d4;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    --border-accent: rgba(16, 185, 129, 0.4);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.12);

    --sidebar-width: 270px;
    --header-height: 72px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition-fast: all 0.2s ease;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.15);
}

/* Reset & Global Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: #2a364f;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition-smooth);
}

.brand {
    padding: 24px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.brand-text {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.3);
    text-transform: uppercase;
}

.nav-menu {
    list-style: none;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    padding: 12px 14px 6px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.92rem;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    position: relative;
    cursor: pointer !important;
    text-decoration: none;
}

.nav-item a i, .nav-item a span {
    pointer-events: none;
}

.nav-item a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: var(--transition-fast);
}

.nav-item a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(3px);
}

.nav-item.active a {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #059669);
    box-shadow: 0 4px 16px var(--primary-glow);
}

.nav-item.active a i {
    color: #fff;
}

.sidebar-user {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.2);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Main Layout Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

/* Top Bar Header */
.top-bar {
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.page-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.search-bar {
    position: relative;
    width: 280px;
}

.search-bar input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    transition: var(--transition-fast);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

/* Main Body Content */
.content-body {
    padding: 32px;
    flex: 1;
}

/* Glass Panels & Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 22px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
    opacity: 0;
    transition: var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glass);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-number {
    font-size: 1.9rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.04em;
    margin-bottom: 4px;
}

.stat-foot {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* Dashboard Split View */
.dashboard-split {
    display: grid;
    grid-template-columns: 1.8fr 1.2fr;
    gap: 24px;
    margin-bottom: 32px;
}

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

.glass-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-glass);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.panel-heading {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

table.modern-table th {
    text-align: left;
    white-space: nowrap;
    background: rgba(15, 23, 42, 0.5);
    padding: 14px 18px;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-subtle);
}

table.modern-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    transition: var(--transition-fast);
}

table.modern-table tbody tr {
    transition: var(--transition-fast);
}

table.modern-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Buttons System */
.btn {
    white-space: nowrap;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer !important;
    border: none;
    transition: var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
    user-select: none;
}

.btn * {
    pointer-events: none;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed !important; transform: none; }
.btn-block { width: 100%; }

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #059669);
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: #243049;
    border-color: var(--border-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-accent);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-glow);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: #fff;
}

.btn-danger:hover {
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

/* Badges System */
.pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}

.pill-success { background: var(--success-bg); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.pill-warning { background: var(--warning-bg); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.pill-danger { background: var(--danger-bg); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.pill-info { background: var(--info-bg); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.pill-secondary { background: rgba(148, 163, 184, 0.1); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.25); }

/* Toast Notification Overlay */
#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-error { border-color: var(--danger); }

.toast-msg {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--primary);
    color: #fff;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glass);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    pointer-events: auto;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Modal Overlay Windows */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    transform: scale(0.94);
    transition: var(--transition-smooth);
}

.modal-backdrop.active .modal-card {
    transform: scale(1);
}

.modal-card.modal-lg { max-width: 860px; }
.modal-card.modal-xl { max-width: 1000px; }
.units-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.units-toolbar p { margin: 0; }

.modal-header {
    padding: 22px 28px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 24px;
    cursor: pointer !important;
    transition: var(--transition-fast);
}

.modal-close:hover { color: #fff; }

/* Forms wrap body + footer, so they must pass the flex layout through;
   otherwise long forms overflow the card and the footer buttons vanish. */
.modal-card > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    overscroll-behavior: contain;
}

.modal-header, .modal-footer { flex-shrink: 0; }

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Signature Pad Canvas Styling */
.signature-pad-box {
    background: #0b0f19;
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
    position: relative;
}

.signature-canvas {
    background: #ffffff;
    border-radius: var(--radius-sm);
    cursor: crosshair !important;
    touch-action: none;
    width: 100%;
    height: 160px;
    display: block;
}

/* Document Preview Style (Screen View) */
.document-preview-box {
    background: #ffffff;
    color: #0f172a;
    padding: 48px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    font-family: 'Times New Roman', Times, serif;
    line-height: 1.7;
    position: relative;
}

.document-header {
    text-align: center;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 20px;
    margin-bottom: 28px;
}

.document-title {
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0f172a;
}

.document-company {
    font-size: 1.1rem;
    font-weight: bold;
    color: #334155;
}

.document-content {
    white-space: pre-wrap;
    font-size: 1.1rem;
    color: #1e293b;
    margin-bottom: 40px;
}

.document-signature {
    margin-top: 50px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.sig-block {
    width: 44%;
    max-width: 300px;
    text-align: center;
}

.sig-img {
    max-height: 70px;
    max-width: 220px;
    object-fit: contain;
    margin-bottom: 4px;
}

.sig-line {
    border-top: 1.5px solid #0f172a;
    padding-top: 6px;
    font-size: 0.95rem;
    font-weight: bold;
}

/* Official Real Estate Verification Stamp Graphic */
.official-stamp-seal {
    width: 148px;
    height: 148px;
    overflow: hidden;
    line-height: 1.25;
    border: 4px double #059669;
    border-radius: 50%;
    color: #059669;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px 16px;
    font-family: 'Arial', sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    transform: rotate(-12deg);
    opacity: 0.88;
    background: rgba(16, 185, 129, 0.04);
    box-shadow: 0 0 0 2px #059669 inset;
}

.stamp-title { font-size: 0.56rem; letter-spacing: 0.06em; }
.stamp-badge { font-size: 0.8rem; border-top: 1px solid #059669; border-bottom: 1px solid #059669; margin: 4px 0; padding: 2px 0; width: 100%; white-space: nowrap; }
.stamp-sub { font-size: 0.5rem; color: #047857; letter-spacing: 0.02em; max-width: 100%; overflow-wrap: anywhere; }

/* Forms */
.form-group { margin-bottom: 20px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control, select.form-control, textarea.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: inherit;
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.form-control { min-height: 100px; resize: vertical; }

/* ==========================================================================
   UTILITIES & COMPONENTS (previously referenced but undefined)
   ========================================================================== */
[hidden] { display: none !important; }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-success { color: #34d399; }
.text-warning { color: #fbbf24; }
.nowrap { white-space: nowrap; }
.break-all { white-space: nowrap; }
.cell-sub { margin-top: 6px; font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.form-hint { font-size: 0.8rem; color: var(--text-tertiary); margin: -8px 0 16px; }

.action-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
td .action-row { min-width: 150px; }

.empty-state { text-align: center; color: var(--text-secondary); padding: 32px 16px !important; }
div.empty-state { grid-column: 1 / -1; }

.contact-line { display: flex; align-items: baseline; gap: 8px; }
.contact-line i { width: 14px; flex-shrink: 0; font-size: 0.8rem; color: var(--text-tertiary); text-align: center; }
.contact-line + .contact-line { margin-top: 2px; font-size: 0.8rem; }

.brand-company { font-size: 0.72rem; color: var(--text-secondary); font-weight: 600; line-height: 1.4; }

/* Property cards */
.property-card { display: flex; flex-direction: column; }
.property-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.property-name { font-size: 1.1rem; line-height: 1.35; min-width: 0; }
.property-address { display: flex; gap: 8px; font-size: 0.82rem; color: var(--text-tertiary); line-height: 1.5; }
.property-address i { color: #f87171; margin-top: 3px; flex-shrink: 0; }
.property-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0 18px; font-size: 0.88rem; }
.property-stats > div { display: flex; gap: 6px; }
.property-card .action-row { margin-top: auto; }

/* Sidebar user card buttons */
.user-icon-btn { background: none; border: none; color: var(--text-tertiary); cursor: pointer; width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.95rem; flex-shrink: 0; transition: var(--transition-fast); text-decoration: none; }
.user-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
.user-avatar { flex-shrink: 0; }

/* Security banner */
.security-banner { display: flex; align-items: center; gap: 12px; margin: 24px 32px 0; padding: 12px 16px; border-radius: var(--radius-md); background: var(--danger-bg); border: 1px solid rgba(239,68,68,0.35); color: #fecaca; font-size: 0.88rem; }
.security-banner i { color: #f87171; }
.security-banner span { flex: 1; }

.sig-buttons { display: flex; flex-wrap: wrap; gap: 10px 12px; margin-top: 10px; }
.sig-preview-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; }
.sig-preview-row:empty { display: none; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Settings */
.settings-panel { max-width: 680px; }
.settings-panel + .settings-panel { margin-top: 24px; }
.panel-heading i { color: var(--primary); margin-right: 6px; }

/* Tenant profile modal */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; margin-bottom: 24px; }
.profile-grid p { margin-bottom: 6px; }
.modal-body h4 { margin: 8px 0 12px; }
.profile-section { margin-bottom: 24px; }

/* Signature previews */
.sig-preview { display: flex; flex-direction: column; gap: 4px; }
.sig-preview small { color: var(--text-secondary); font-weight: 600; }
.sig-preview img { height: 44px; background: #fff; border: 1px solid #475569; border-radius: 6px; padding: 2px; }
.sig-space { height: 50px; }

/* Documents / receipts */
.stamp-position { position: absolute; top: 36px; right: 36px; }
.receipt-doc .document-header { text-align: left; padding-right: 200px; }
.receipt-meta { display: flex; justify-content: space-between; gap: 24px; margin: 28px 0; font-size: 0.95rem; }
.receipt-meta > div:last-child { text-align: right; }
.receipt-meta code { background: #f1f5f9; color: #0f172a; }
.receipt-table { width: 100%; border-collapse: separate; border-spacing: 0; border-top: 1px solid #cbd5e1; border-left: 1px solid #cbd5e1; margin-bottom: 24px; font-family: Arial, sans-serif; font-size: 0.92rem; color: #0f172a; }
.receipt-table th, .receipt-table td { padding: 12px 14px; border-right: 1px solid #cbd5e1; border-bottom: 1px solid #cbd5e1; text-align: left; }
.receipt-table th { background: #f1f5f9; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.receipt-table .num { text-align: right; white-space: nowrap; }
.receipt-total td { font-weight: bold; background: #f8fafc; }
.receipt-total .num { color: #059669; font-size: 1.05rem; }
.receipt-item-detail { margin-top: 3px; font-size: 0.82rem; color: #475569; line-height: 1.45; white-space: pre-line; }
.receipt-notes { font-size: 0.92rem; margin-bottom: 8px; }
.document-contact { font-size: 0.9rem; color: #475569; }
.document-kicker { font-size: 0.85rem; font-weight: bold; color: #475569; margin-top: 4px; }
.document-header .document-company { margin-top: 8px; }

/* Login screen */
.login-body { min-height: 100vh; display: flex; background: radial-gradient(circle at 20% 10%, rgba(16,185,129,0.12), transparent 45%), radial-gradient(circle at 85% 90%, rgba(99,102,241,0.12), transparent 40%), var(--bg-base); }
.login-shell { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 420px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-glass); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-company { font-size: 0.78rem; color: var(--text-secondary); font-weight: 600; }
.login-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.login-sub { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 24px; }
.login-error { background: var(--danger-bg); border: 1px solid rgba(239,68,68,0.35); color: #fca5a5; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.88rem; margin-bottom: 16px; }

/* Mobile navigation */
.menu-toggle { display: none; background: none; border: 1px solid var(--border-subtle); color: var(--text-primary); width: 40px; height: 40px; border-radius: var(--radius-sm); font-size: 1.1rem; cursor: pointer; flex-shrink: 0; }
.sidebar-scrim { display: none; }
body.modal-open { overflow: hidden; }

@media (max-width: 1280px) {
    .search-bar { width: 220px; }
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.6); }
    body.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 95; }
    .main-wrapper { margin-left: 0; width: 100%; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .page-title { font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .page-title-group { min-width: 0; }
    .top-bar { padding: 12px 20px; gap: 10px 12px; height: auto; min-height: var(--header-height); flex-wrap: wrap; }
    .page-title-group { flex: 1; }
    .header-actions { display: contents; }
    .header-actions .btn { order: 1; }
    .search-bar { order: 2; width: 100%; }
    .content-body { padding: 24px 20px; }
    .security-banner { margin: 20px 20px 0; }
}

@media (max-width: 700px) {
    .hide-sm { display: none; }
    .header-actions { gap: 8px; }
    .header-actions .btn-sm { width: 38px; height: 38px; padding: 0; }
    .content-body { padding: 16px; }
    .security-banner { margin: 16px 16px 0; flex-wrap: wrap; align-items: flex-start; }
    .security-banner span { flex: 1 1 calc(100% - 32px); }
    .security-banner .btn { width: 100%; }
    #toastContainer { top: 16px; bottom: auto; left: 16px; right: 16px; }
    .toast-msg { min-width: 0; }
    .panel-actions { width: 100%; }
    .panel-actions .btn { flex: 1 1 auto; }
    .stats-grid { grid-template-columns: 1fr; gap: 14px; }
    #propertiesGrid { grid-template-columns: 1fr !important; }
    .glass-panel { padding: 18px 16px; }
    .panel-head { flex-wrap: wrap; gap: 12px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal-card, .modal-card.modal-lg, .modal-card.modal-xl { max-width: 100%; max-height: 94vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    .modal-header { padding: 18px 20px; }
    .modal-body { padding: 20px; }
    .modal-footer { padding: 16px 20px; flex-wrap: wrap; }
    .modal-footer .btn { flex: 1; }
    .profile-grid { grid-template-columns: 1fr; }
    .document-preview-box { padding: 24px 18px; }
    .stamp-position { position: static; display: flex; justify-content: flex-end; margin-bottom: 12px; }
    .receipt-doc .document-header { padding-right: 0; }
    .receipt-meta { flex-direction: column; }
    .receipt-meta > div:last-child { text-align: left; }
    .document-signature { flex-direction: column; align-items: stretch; gap: 32px; }
    .sig-block { width: 100%; }
    .settings-panel { max-width: none; }
    .login-card { padding: 24px 20px; }
}

/* ==========================================================================
   PRINT MEDIA RULES - print only the open receipt / notice
   ========================================================================== */
@media print {
    @page { margin: 14mm; }
    html, body { background: #fff !important; color: #000 !important; }
    body.modal-open { overflow: visible; }
    #app, #toastContainer, .security-banner { display: none !important; }
    .modal-backdrop { display: none !important; }
    #documentModal.active { display: block !important; position: static !important; background: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; padding: 0 !important; opacity: 1 !important; visibility: visible !important; }
    #documentModal .modal-header, #documentModal .modal-footer { display: none !important; }
    #documentModal .modal-card, #documentModal .modal-card.modal-lg { display: block !important; border: none !important; box-shadow: none !important; max-width: none !important; width: auto !important; max-height: none !important; background: #fff !important; transform: none !important; }
    #documentModal .modal-body, .document-preview-box { width: auto !important; max-width: none !important; }
    .document-preview-box { padding-right: 2px !important; } /* keep the table's outer border inside the printable area */
    #documentModal .modal-body { padding: 0 !important; overflow: visible !important; }
    .document-preview-box { box-shadow: none !important; border: none !important; border-radius: 0 !important; padding: 0 !important; margin: 0 !important; color: #000 !important; }
    .official-stamp-seal, .receipt-table th, .receipt-total td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .document-signature { break-inside: avoid; }
}
