/* ============================================================================
   T&B Custom Clean — portal + auth styles
   Inherits design tokens from style.css
   ========================================================================== */

/* ============================ AUTH (login) ============================ */
.auth-body { background: var(--cream); }
.auth-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

.auth-visual { position: relative; overflow: hidden; }
.auth-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.auth-visual-overlay { position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(56,66,46,.82), rgba(56,66,46,.35) 55%, rgba(44,49,42,.7)); }
.auth-visual-copy { position: relative; z-index: 2; height: 100%; padding: 48px;
    display: flex; flex-direction: column; justify-content: space-between; }
.auth-visual-copy .brand img { width: 52px; height: 52px; border-radius: 50%; background: var(--cream); padding: 3px; }

.auth-form-wrap { display: grid; place-items: center; padding: 40px var(--gutter); }
.auth-form { width: 100%; max-width: 410px; }
.auth-form-logo { display: none; }   /* shown only when the visual panel is hidden (mobile) */
.auth-form-logo img { width: 66px; height: 66px; border-radius: 50%; }
.auth-back { font-size: .8rem; letter-spacing: .04em; color: var(--ink-faint); display: inline-block; margin-bottom: 30px; }
.auth-back:hover { color: var(--sage-deep); }

.auth-demo { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
.auth-demo-title { font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--sage-deep); margin-bottom: 14px; }
.demo-chip { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left;
    background: var(--cream-2); border: 1px solid var(--line-soft); border-radius: 12px;
    padding: 12px 16px; margin-bottom: 10px; transition: .3s var(--ease); }
.demo-chip:hover { border-color: var(--sage); transform: translateY(-1px); }
.demo-chip strong { font-family: var(--sans); font-weight: 500; font-size: .9rem; color: var(--olive-ink); }
.demo-chip span { font-size: .8rem; color: var(--ink-faint); }
.auth-demo-note { font-size: .76rem; color: var(--ink-faint); margin-top: 4px; }

/* Coming-soon portal page */
.soon-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.soon-list li { display: flex; gap: 13px; align-items: center; font-size: .98rem; color: var(--ink-soft); }
.soon-list li svg { width: 22px; height: 22px; color: var(--sage-deep); flex: none; }
.soon-staff { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line-soft); font-size: .86rem; color: var(--ink-faint); }
.soon-staff a { color: var(--sage-deep); border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.soon-staff a:hover { color: var(--olive-ink); }

/* ============================ PORTAL SHELL ============================ */
.portal-body { background: var(--cream-2); }
.portal-shell { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }

.side { position: sticky; top: 0; height: 100vh; background: var(--olive-ink); color: rgba(250,246,238,.8);
    display: flex; flex-direction: column; padding: 26px 20px; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 4px; }
/* Logo art is transparent with dark linework — seat it on a light coin so it
   reads against the dark sidebar. */
.side-brand img { width: 46px; height: 46px; border-radius: 50%; background: var(--cream);
    padding: 3px; box-shadow: 0 2px 10px rgba(0,0,0,.22); }
.side-brand .brand-name strong { color: var(--cream); font-size: 1.25rem; }
.side-brand .brand-name span { color: var(--sage-soft); }
.side-role { font-size: .64rem; letter-spacing: .22em; text-transform: uppercase; color: var(--sage-soft);
    padding: 18px 8px 14px; border-bottom: 1px solid rgba(250,246,238,.1); margin-bottom: 14px; }

.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 11px;
    color: rgba(250,246,238,.74); font-size: .92rem; transition: .25s var(--ease); }
.side-nav a .ic { display: grid; place-items: center; width: 20px; height: 20px; flex: none; opacity: .85; }
.side-nav a .ic svg { width: 19px; height: 19px; }
.side-nav a:hover { background: rgba(250,246,238,.07); color: var(--cream); }
.side-nav a.is-active { background: var(--sage-deep); color: #fff; }
.side-badge { margin-left: auto; background: var(--cream); color: var(--olive-ink); font-size: .68rem; font-weight: 500;
    min-width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; padding: 0 6px; }
.side-nav a.is-active .side-badge { background: #fff; }

.side-foot { border-top: 1px solid rgba(250,246,238,.1); padding-top: 16px; }
.side-user { display: flex; align-items: center; gap: 12px; padding: 4px 6px 14px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--sage-deep); color: #fff;
    display: grid; place-items: center; font-size: .85rem; font-weight: 500; letter-spacing: .04em; flex: none; }
.side-user-meta strong { display: block; color: var(--cream); font-family: var(--sans); font-weight: 500; font-size: .92rem; }
.side-user-meta span { font-size: .78rem; color: var(--sage-soft); }
.side-logout { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 11px;
    color: rgba(250,246,238,.7); font-size: .88rem; }
.side-logout svg { width: 18px; height: 18px; }
.side-logout:hover { background: rgba(250,246,238,.07); color: var(--cream); }

/* ---- Topbar ---- */
.portal-main { display: flex; flex-direction: column; min-width: 0; }
.portal-topbar { display: flex; align-items: center; gap: 16px; padding: 20px clamp(20px, 4vw, 44px);
    background: var(--cream); border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 20; }
.portal-topbar h1 { font-size: 1.7rem; font-weight: 500; }
/* Logo in the top bar — primarily for mobile, where the sidebar (and its logo)
   is tucked off-canvas. */
.topbar-logo { display: none; align-items: center; }
.topbar-logo img { width: 36px; height: 36px; border-radius: 50%; }
.topbar-site { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: .8rem;
    letter-spacing: .04em; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; }
.topbar-site svg { width: 17px; height: 17px; }
.topbar-site:hover { border-color: var(--sage); color: var(--sage-deep); }
.side-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; padding: 6px; }
.side-toggle span { width: 24px; height: 2px; background: var(--olive-ink); border-radius: 2px; }

.portal-content { padding: clamp(22px, 4vw, 44px); flex: 1; }

/* ============================ UI PRIMITIVES ============================ */
.card { background: var(--cream); border: 1px solid var(--line-soft); border-radius: 16px;
    box-shadow: 0 18px 40px -34px rgba(56,66,46,.5); }
.card-pad { padding: clamp(20px, 3vw, 30px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 20px 26px; border-bottom: 1px solid var(--line-soft); }
.card-head h2, .card-head h3 { font-size: 1.35rem; font-weight: 500; }
.muted { color: var(--ink-faint); }
.stack > * + * { margin-top: 22px; }

.welcome { margin-bottom: 28px; }
.welcome .script { font-size: 2.4rem; color: var(--sage-deep); }
.welcome h2 { font-size: 2rem; font-weight: 500; margin-top: -6px; }
.welcome p { margin-top: 6px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 28px; }
.kpi { background: var(--cream); border: 1px solid var(--line-soft); border-radius: 16px; padding: 22px 24px;
    box-shadow: 0 18px 40px -36px rgba(56,66,46,.5); }
.kpi .ic { width: 40px; height: 40px; border-radius: 11px; background: #e8ecdf; color: var(--sage-deep);
    display: grid; place-items: center; margin-bottom: 16px; }
.kpi .ic svg { width: 20px; height: 20px; }
.kpi .num { font-family: var(--serif); font-size: 2.4rem; color: var(--olive-ink); line-height: 1; }
.kpi .lbl { font-size: .82rem; color: var(--ink-soft); margin-top: 6px; }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: .72rem; letter-spacing: .04em;
    padding: 6px 13px; border-radius: 999px; font-weight: 400; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.is-scheduled { background: #eef0e7; color: #6c7a5d; }
.pill.is-progress  { background: #f4ead2; color: #97712f; }
.pill.is-complete  { background: #e3ebda; color: #4c6b3f; }
.pill.is-review    { background: #f6e6df; color: #9a5234; }
.pill.is-default   { background: var(--sand); color: var(--ink-soft); }
.pill.is-new       { background: #e3ebda; color: #4c6b3f; }
.pill.is-contacted { background: #eef0e7; color: #6c7a5d; }
.pill.is-won       { background: #dfe8d5; color: #3f6b3f; }
.pill.is-archived  { background: var(--sand); color: var(--ink-faint); }

/* Property cards (client dashboard) */
.prop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.prop-card { overflow: hidden; }
.prop-card .ph { height: 160px; position: relative; }
.prop-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.prop-card .ph .pill { position: absolute; top: 12px; left: 12px; background: rgba(250,246,238,.95); }
.prop-card .body { padding: 18px 20px 20px; }
.prop-card .body h3 { font-size: 1.3rem; font-weight: 500; }
.prop-card .body .addr { font-size: .82rem; color: var(--ink-faint); margin-top: 2px; }
.prop-meta { display: flex; gap: 16px; margin: 14px 0; font-size: .82rem; color: var(--ink-soft); }
.prop-meta span { display: inline-flex; align-items: center; gap: 6px; }

/* Timeline (turnovers) */
.timeline { position: relative; }
.tl-item { display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.tl-item:last-child { border-bottom: 0; }
.tl-date { text-align: center; }
.tl-date .d { font-family: var(--serif); font-size: 1.7rem; color: var(--olive-ink); line-height: 1; }
.tl-date .m { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--sage-deep); }
.tl-body { min-width: 0; }
.tl-body .top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tl-body h4 { font-size: 1.12rem; font-weight: 500; }
.tl-body .notes { font-size: .9rem; color: var(--ink-soft); margin-top: 5px; }
.tl-progress { height: 6px; background: var(--sand); border-radius: 999px; margin-top: 12px; overflow: hidden; max-width: 320px; }
.tl-progress i { display: block; height: 100%; background: var(--sage); border-radius: 999px; }
.tl-progress-lbl { font-size: .74rem; color: var(--ink-faint); margin-top: 6px; }

/* ============================ MESSAGING ============================ */
.thread { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 460px; }
.thread-scroll { flex: 1; overflow-y: auto; padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: 70%; padding: 13px 17px; border-radius: 16px; font-size: .95rem; line-height: 1.5; position: relative; }
.bubble .when { display: block; font-size: .68rem; margin-top: 6px; opacity: .65; letter-spacing: .03em; }
.bubble.them { align-self: flex-start; background: var(--cream-2); border: 1px solid var(--line-soft); color: var(--ink); border-bottom-left-radius: 5px; }
.bubble.me { align-self: flex-end; background: var(--sage-deep); color: #fff; border-bottom-right-radius: 5px; }
.bubble.me .when { color: rgba(255,255,255,.8); }
.thread-day { align-self: center; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint);
    background: var(--cream-2); padding: 4px 14px; border-radius: 999px; margin: 6px 0; }
.thread-empty { margin: auto; text-align: center; color: var(--ink-faint); max-width: 36ch; }
.thread-compose { border-top: 1px solid var(--line-soft); padding: 16px 20px; display: flex; gap: 12px; align-items: flex-end; }
.thread-compose textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 14px;
    padding: 12px 16px; font-family: var(--sans); font-size: .95rem; line-height: 1.5; max-height: 140px; background: var(--cream-2); }
.thread-compose textarea:focus { outline: none; border-color: var(--sage); background: #fff; }
.send-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--olive); color: #fff;
    display: grid; place-items: center; flex: none; transition: .3s var(--ease); }
.send-btn:hover { background: var(--sage-deep); transform: translateY(-1px); }
.send-btn svg { width: 20px; height: 20px; }

/* Admin thread list */
.thread-layout { display: grid; grid-template-columns: 320px 1fr; gap: 0; border: 1px solid var(--line-soft);
    border-radius: 16px; overflow: hidden; background: var(--cream); height: calc(100vh - 200px); min-height: 500px; }
.thread-list { border-right: 1px solid var(--line-soft); overflow-y: auto; background: var(--cream-2); }
.thread-list-item { display: flex; gap: 12px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line-soft);
    cursor: pointer; transition: background .2s; }
.thread-list-item:hover { background: var(--cream); }
.thread-list-item.is-active { background: var(--cream); box-shadow: inset 3px 0 0 var(--sage-deep); }
.thread-list-item .avatar { width: 38px; height: 38px; font-size: .8rem; }
.tli-meta { min-width: 0; flex: 1; }
.tli-meta strong { display: block; font-family: var(--sans); font-weight: 500; font-size: .92rem; color: var(--olive-ink); }
.tli-meta span { display: block; font-size: .8rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tli-unread { width: 9px; height: 9px; border-radius: 50%; background: var(--sage-deep); flex: none; }
.thread-panel { display: flex; flex-direction: column; min-width: 0; }
.thread-panel-head { padding: 18px 24px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; }
.thread-panel-head h3 { font-size: 1.2rem; font-weight: 500; }

/* ============================ ADMIN TABLES ============================ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
    color: var(--sage-deep); font-weight: 500; padding: 14px 18px; border-bottom: 1px solid var(--line); }
table.data td { padding: 16px 18px; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--cream-2); }
table.data .lead-name { font-family: var(--serif); font-size: 1.15rem; color: var(--olive-ink); }
table.data .lead-msg { max-width: 380px; }
.lead-actions { display: flex; gap: 8px; }
.mini-btn { border: 1px solid var(--line); background: var(--cream); border-radius: 999px; padding: 6px 14px;
    font-size: .72rem; letter-spacing: .04em; color: var(--ink-soft); }
.mini-btn:hover { border-color: var(--sage); color: var(--sage-deep); }
.mini-btn.solid { background: var(--olive); color: #fff; border-color: var(--olive); }

/* CRM "coming soon" shell */
.crm-shell { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); gap: 18px; margin-top: 8px; }
.crm-feature { border: 1px dashed var(--line); border-radius: 16px; padding: 24px; background: var(--cream); }
.crm-feature .ic { width: 42px; height: 42px; border-radius: 11px; background: #e8ecdf; color: var(--sage-deep);
    display: grid; place-items: center; margin-bottom: 14px; }
.crm-feature .ic svg { width: 20px; height: 20px; }
.crm-feature h3 { font-size: 1.2rem; font-weight: 500; margin-bottom: 6px; }
.crm-feature p { font-size: .88rem; }
.soon { display: inline-block; font-size: .62rem; letter-spacing: .16em; text-transform: uppercase;
    color: var(--sage-deep); background: #e8ecdf; padding: 4px 10px; border-radius: 999px; margin-top: 14px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-faint); }
.empty-state svg { width: 46px; height: 46px; color: var(--sage-soft); margin-bottom: 14px; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 900px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
    .auth-form-logo { display: inline-flex; margin-bottom: 22px; }
    .thread-layout { grid-template-columns: 1fr; height: auto; }
    .thread-list { max-height: 240px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
}
@media (max-width: 820px) {
    .portal-shell { grid-template-columns: 1fr; }
    .side { position: fixed; left: 0; top: 0; z-index: 60; width: 270px; transform: translateX(-100%);
        transition: transform .35s var(--ease); }
    .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(44,49,42,.4); }
    .side-toggle { display: flex; }
    .topbar-logo { display: inline-flex; }
    .portal-topbar h1 { font-size: 1.3rem; }
    .topbar-site span { display: none; }      /* icon-only to save room */
    .topbar-site { padding: 9px 11px; }
}
