/* ============================================================
   Real Estate ERP - design system
   Palette : Indigo (primary) - Amber (accent) - Cool paper bg
   Type    : "Plus Jakarta Sans" (display) + "Inter" (body)
   Shell   : top app bar + desktop sidebar + mobile bottom tabs
   ============================================================ */

:root {
    --re-bg: #f4f6fb;
    --re-card: #ffffff;
    --re-ink: #151a2d;
    --re-muted: #6b7392;
    --re-border: #e3e7f0;
    --re-primary: #4f46e5;
    --re-primary-dark: #4338ca;
    --re-primary-soft: #eef2ff;
    --re-accent: #f59e0b;
    --re-ring: rgba(79, 70, 229, .3);
    --re-radius: 1rem;
}

html { -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--re-bg);
    color: var(--re-ink);
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

h1, h2, h3, .font-display {
    font-family: 'Plus Jakarta Sans', 'Inter', ui-sans-serif, system-ui, sans-serif;
    letter-spacing: -0.01em;
}

/* ---------- app shell ---------- */

.page-content {
    padding-top: 4.5rem;      /* clears the fixed top bar */
    padding-bottom: 6.5rem;   /* clears the mobile tab bar */
    min-height: 100vh;
}

@media (min-width: 768px) {
    .page-content {
        margin-left: 16.5rem;  /* clears the sidebar */
        padding-bottom: 3rem;
    }
}

/* the tab bar respects the iPhone home indicator */
.bottom-nav { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ---------- components ---------- */

.card {
    background: var(--re-card);
    border: 1px solid var(--re-border);
    border-radius: var(--re-radius);
    box-shadow: 0 1px 2px rgba(21, 26, 45, .04);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    border-radius: .75rem; font-weight: 600; font-size: .875rem;
    padding: .625rem 1rem; transition: all .15s ease; white-space: nowrap;
    border: 1px solid transparent; cursor: pointer;
}
.btn:focus-visible { outline: 2px solid var(--re-ring); outline-offset: 2px; }
.btn-primary { background: var(--re-primary); color: #fff; }
.btn-primary:hover { background: var(--re-primary-dark); }
.btn-primary:active { transform: scale(.98); }
.btn-secondary { background: #fff; border-color: var(--re-border); color: var(--re-ink); }
.btn-secondary:hover { background: #f1f3f9; }
.btn-accent { background: var(--re-accent); color: #4a2c00; }
.btn-accent:hover { background: #ea8f06; }
.btn-ghost { color: var(--re-muted); }
.btn-ghost:hover { background: #eaedf5; color: var(--re-ink); }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, select.input, textarea.input {
    width: 100%; background: #fff; border: 1px solid var(--re-border);
    border-radius: .75rem; padding: .65rem .85rem; font-size: .95rem; color: var(--re-ink);
}
.input:focus { outline: none; border-color: var(--re-primary); box-shadow: 0 0 0 3px var(--re-ring); }
.input:disabled, .input[readonly] { background: #f5f6fa; color: var(--re-muted); }

.label { display: block; font-size: .72rem; font-weight: 700; color: var(--re-muted);
         letter-spacing: .04em; margin-bottom: .35rem; text-transform: uppercase; }

.field-error { color: #dc2626; font-size: .75rem; margin-top: .3rem; display: block; }

.badge { display: inline-flex; align-items: center; gap: .25rem;
         padding: .2rem .6rem; border-radius: 999px; font-size: .7rem; font-weight: 700;
         white-space: nowrap; }

/* sidebar links */
.nav-item {
    display: flex; align-items: center; gap: .75rem;
    margin: .125rem .75rem; padding: .6rem .85rem;
    border-radius: .75rem; font-size: .875rem; color: #414a68;
    transition: background .12s ease;
}
.nav-item:hover { background: #eaedf5; }
.nav-item.active { background: var(--re-primary-soft); color: var(--re-primary-dark); font-weight: 600; }
.nav-item i { font-size: 1.05rem; width: 1.25rem; text-align: center; }
.nav-group { padding: 1rem 1.5rem .35rem; font-size: .65rem; font-weight: 800;
             letter-spacing: .1em; text-transform: uppercase; color: #98a0bd; }

/* mobile bottom tabs */
.tab-item { display: flex; flex-direction: column; align-items: center; gap: .15rem;
            flex: 1; padding: .5rem 0 .35rem; font-size: .65rem; font-weight: 600;
            color: #8b93b0; background: none; border: none; }
.tab-item i { font-size: 1.3rem; line-height: 1; }
.tab-item.active { color: var(--re-primary); }
.tab-item.active i { transform: translateY(-1px); }

/* tables */
.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; font-size: .875rem; border-collapse: collapse; }
.table-wrap thead th { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
    background: #f7f8fc; color: var(--re-muted); font-weight: 700; text-align: left;
    padding: .75rem 1rem; white-space: nowrap; }
.table-wrap tbody td { padding: .75rem 1rem; border-top: 1px solid var(--re-border);
    vertical-align: middle; }
.table-wrap tbody tr:hover { background: #fafbff; }

/* drawer scrim */
#scrim { position: fixed; inset: 0; background: rgba(21, 26, 45, .45); z-index: 25;
         opacity: 0; pointer-events: none; transition: opacity .2s ease; }
#scrim.show { opacity: 1; pointer-events: auto; }

/* top progress bar */
#re-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0;
    background: linear-gradient(90deg, var(--re-primary), #818cf8, var(--re-accent));
    z-index: 60; border-radius: 0 2px 2px 0; opacity: 0;
    transition: width .25s ease, opacity .3s ease; }
#re-progress.active { opacity: 1; }

/* toasts */
#re-toasts { position: fixed; top: 4.25rem; right: 1rem; left: 1rem; z-index: 55;
    display: flex; flex-direction: column; gap: .5rem; align-items: flex-end; pointer-events: none; }
@media (min-width: 640px) { #re-toasts { left: auto; width: 24rem; } }
.re-toast { pointer-events: auto; width: 100%; display: flex; align-items: flex-start; gap: .6rem;
    background: #fff; border: 1px solid var(--re-border); border-radius: .9rem;
    box-shadow: 0 8px 24px rgba(21, 26, 45, .14); padding: .8rem 1rem; font-size: .875rem;
    animation: re-toast-in .25s ease; }
.re-toast.success { border-left: 4px solid #10b981; }
.re-toast.error { border-left: 4px solid #dc2626; }
@keyframes re-toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.re-toast.hide { opacity: 0; transform: translateY(-6px); transition: all .3s ease; }

/* pager */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: .75rem; margin-top: 1rem; font-size: .8rem; color: var(--re-muted); }
.pager .pages { display: flex; gap: .25rem; flex-wrap: wrap; }
.pager a, .pager span.pg { min-width: 2.1rem; height: 2.1rem; display: inline-flex; align-items: center;
    justify-content: center; padding: 0 .5rem; border-radius: .6rem; border: 1px solid var(--re-border);
    background: #fff; font-weight: 600; color: var(--re-ink); }
.pager a:hover { background: #eaedf5; }
.pager .current { background: var(--re-primary); border-color: var(--re-primary); color: #fff; }
.pager .disabled { opacity: .4; pointer-events: none; }

/* progress bars (collection, pipeline, poll-style) */
.meter { height: .5rem; border-radius: 999px; background: #e8ebf4; overflow: hidden; }
.meter > div { height: 100%; border-radius: 999px; background: var(--re-primary); transition: width .4s ease; }
.meter.amber > div { background: var(--re-accent); }
.meter.green > div { background: #10b981; }
.meter.rose > div { background: #f43f5e; }

/* timeline (lead / booking activity) */
.timeline { position: relative; padding-left: 1.75rem; }
.timeline::before { content: ''; position: absolute; left: .55rem; top: .35rem; bottom: .35rem;
    width: 2px; background: var(--re-border); }
.timeline-item { position: relative; padding-bottom: 1.1rem; }
.timeline-item::before { content: ''; position: absolute; left: -1.45rem; top: .3rem;
    width: .7rem; height: .7rem; border-radius: 999px; background: var(--re-primary);
    box-shadow: 0 0 0 3px var(--re-primary-soft); }

/* status pill row on the inventory board */
.unit-tile { border: 1px solid var(--re-border); border-radius: .75rem; padding: .6rem;
    text-align: center; background: #fff; transition: transform .12s ease, box-shadow .12s ease; }
.unit-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(21, 26, 45, .1); }

/* 1-5 rating picker (site visit interest) */
.rate { display: flex; gap: .4rem; }
.rate input { position: absolute; opacity: 0; pointer-events: none; }
.rate label { width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: .8rem;
    border: 1px solid var(--re-border); background: #fff; font-weight: 700; color: var(--re-muted);
    cursor: pointer; transition: all .12s ease; }
.rate label:hover { border-color: var(--re-primary); color: var(--re-primary); }
.rate input:checked + label { background: var(--re-primary); border-color: var(--re-primary);
    color: #fff; transform: scale(1.06); }

/* empty states */
.empty { padding: 3rem 1rem; text-align: center; color: var(--re-muted); }
.empty i { font-size: 2.5rem; color: #c3c9dd; display: block; margin-bottom: .5rem; }

/* print: receipts and quotations printed straight from the browser */
@media print {
    header, nav, .no-print, #re-toasts, #re-progress { display: none !important; }
    .page-content { padding: 0 !important; margin: 0 !important; }
    .card { box-shadow: none; border-color: #ccc; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
