/* ===== Contact Us & admin inbox ===== */
@view-transition { navigation: auto; }
[x-cloak] { display: none !important; }
[hidden] { display: none !important; }

.ct-page { padding: 6rem 0 4rem; min-height: 70vh; background: var(--bg-gradient-hero); }
.ct-narrow { max-width: 760px; margin: 0 auto; padding: 0 1rem; }
.ct-wide { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.ct-hero { margin-bottom: 2rem; }
.ct-hero h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--text-dark); }
.ct-hero p { color: var(--text-muted); margin-top: .5rem; font-size: 1.0625rem; max-width: 560px; }

.ct-card {
    background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-card); padding: 1.75rem;
}
.ct-card + .ct-card { margin-top: 1.5rem; }
.ct-card h2 { font-size: 1.25rem; font-weight: 700; color: var(--text-dark); margin-bottom: .5rem; }
.ct-card > p { color: var(--text-muted); }
.ct-status { color: var(--text-muted); text-align: center; padding: 2.5rem 0; }

.ct-skeleton { height: 220px; border-radius: var(--radius-2xl); background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

.ct-gate { text-align: center; padding: 2.5rem 1.75rem; }
.ct-gate p { margin: 0 auto 1.5rem; max-width: 440px; }
.ct-google {
    display: inline-flex; align-items: center; gap: .75rem; padding: .8rem 1.4rem; border-radius: var(--radius-lg);
    border: 1px solid var(--border-color); background: #fff; color: var(--text-dark); font: inherit; font-weight: 600;
    cursor: pointer; box-shadow: var(--shadow-sm);
}
.ct-google:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); }
.ct-google svg { width: 20px; height: 20px; }

.ct-who-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: .875rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.ct-who-bar b { color: var(--text-dark); }
.ct-link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-color); cursor: pointer; }

.ct-field { margin-bottom: 1.125rem; }
.ct-field label { display: block; font-weight: 600; font-size: .9375rem; color: var(--text-dark); margin-bottom: .375rem; }
.ct-field label small { font-weight: 400; color: var(--text-light); }
.ct-field input, .ct-field select, .ct-field textarea {
    width: 100%; padding: .75rem .875rem; border: 1px solid var(--border-color); border-radius: var(--radius-md);
    font: inherit; font-size: 1rem; color: var(--text-dark); background: #fff;
}
.ct-field textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.ct-field input:focus, .ct-field select:focus, .ct-field textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.ct-hint { font-size: .8125rem; color: var(--text-light); margin-top: .375rem; }
.ct-error { color: var(--error-color); font-size: .875rem; margin: .25rem 0 1rem; }
.ct-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.ct-sent {
    margin-top: 1.25rem; border-radius: var(--radius-xl); padding: 1rem 1.125rem;
    background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
}
.ct-sent b { display: block; margin-bottom: .25rem; }

/* Threads */
.ct-thread { border-top: 1px solid var(--border-color); padding: 1.25rem 0; }
.ct-thread:first-of-type { border-top: 0; padding-top: .5rem; }
.ct-thread header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.ct-meta { font-size: .8125rem; color: var(--text-light); margin: .25rem 0 .875rem; }
.ct-pill { font-size: .75rem; font-weight: 700; padding: .2rem .65rem; border-radius: 999px; white-space: nowrap; }
.ct-pill.ok { background: #e3f6ee; color: #0e9f6e; }
.ct-pill.wait { background: #fdf1dc; color: #b45309; }
.ct-pill.new { background: #fde4e4; color: #dc2626; }

.ct-msg { border-radius: 14px; padding: .75rem .9rem; margin-bottom: .625rem; max-width: 92%; }
.ct-msg.user { background: var(--primary-gradient-soft); border: 1px solid rgba(79, 70, 229, .15); margin-left: auto; }
.ct-msg.auto { background: #f8fafc; border: 1px dashed var(--border-color); }
.ct-msg.admin { background: #fff; border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.ct-who { font-size: .75rem; font-weight: 600; color: var(--text-muted); margin-bottom: .25rem; }
.ct-body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-dark); line-height: 1.55; font-size: .9375rem; }

/* Admin inbox */
.ib-layout { display: grid; grid-template-columns: 380px 1fr; gap: 1.5rem; align-items: start; }
.ib-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.ib-tabs button {
    border: 1px solid var(--border-color); background: #fff; border-radius: 999px; padding: .4rem .9rem;
    font: inherit; font-size: .875rem; cursor: pointer; color: var(--text-gray);
}
.ib-tabs button.active { background: var(--text-dark); color: #fff; border-color: var(--text-dark); }
.ib-list { padding: .5rem; }
.ib-item {
    display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; cursor: pointer;
    padding: .875rem; border-radius: var(--radius-lg); color: inherit;
}
.ib-item + .ib-item { border-top: 1px solid #f1f5f9; }
.ib-item:hover { background: #f8fafc; }
.ib-item.active { background: var(--primary-gradient-soft); }
.ib-item-top { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.ib-item-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-item small { display: block; color: var(--text-light); font-size: .75rem; margin-top: .125rem; }
.ib-item p { color: var(--text-muted); font-size: .875rem; margin-top: .25rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ib-more { text-align: center; padding: .75rem 0 .25rem; }
.ib-sender { display: grid; grid-template-columns: max-content 1fr; gap: .375rem 1rem; font-size: .9375rem; margin: 1rem 0 1.5rem; }
.ib-sender dt { color: var(--text-light); }
.ib-sender dd { color: var(--text-dark); overflow-wrap: anywhere; }
.ib-empty { color: var(--text-muted); text-align: center; padding: 3rem 1rem; }
/* What the sender read on the site (admin_visitor_activity) */
.ib-activity { margin: -.5rem 0 1.5rem; padding: .875rem 1rem; border: 1px solid var(--border-color); border-radius: 12px; background: #f8fafc; }
.ib-activity h3 { font-size: .8125rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 .5rem; }
.ib-act-meta { font-size: .875rem; color: var(--text-gray); line-height: 1.6; }
.ib-act-meta b { color: var(--text-dark); font-weight: 600; }
.ib-act-pages { list-style: none; margin: .625rem 0 0; padding: .625rem 0 0; border-top: 1px solid var(--border-color); display: grid; gap: .25rem; font-size: .875rem; }
.ib-act-pages li { display: flex; justify-content: space-between; gap: 1rem; color: var(--text-dark); }
.ib-act-pages span { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ib-act-none { font-size: .875rem; color: var(--text-muted); margin: 0; }

@media (max-width: 900px) {
    .ib-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .ct-page { padding-top: 4.5rem; }
    .ct-hero h1 { font-size: 1.875rem; }
    .ct-card { padding: 1.25rem; }
    .ct-msg { max-width: 100%; }
}

/* ===== Contact Us as a chat (js/contact.js) ===== */
.ch-app {
    display: grid; grid-template-columns: 320px 1fr; height: min(720px, calc(100vh - 9rem)); min-height: 520px;
    background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-2xl); box-shadow: var(--shadow-card); overflow: hidden;
}
.ch-side { display: flex; flex-direction: column; border-right: 1px solid var(--border-color); min-height: 0; background: #fbfcfe; }
.ch-side-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: 1rem 1rem .75rem; }
.ch-side-head b { font-size: 1.0625rem; color: var(--text-dark); }
.ch-list { flex: 1; overflow-y: auto; padding: 0 .5rem .5rem; }
.ch-empty { color: var(--text-muted); font-size: .875rem; text-align: center; padding: 2rem 1rem; }
.ch-item {
    display: grid; grid-template-columns: 1fr auto; gap: .25rem .5rem; width: 100%; text-align: left; border: 0; background: none;
    font: inherit; cursor: pointer; padding: .75rem; border-radius: var(--radius-lg); color: inherit;
}
.ch-item + .ch-item { margin-top: 2px; }
.ch-item:hover { background: #f1f5f9; }
.ch-item.active { background: var(--primary-gradient-soft); }
.ch-item-top { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; min-width: 0; }
.ch-item-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dark); font-size: .9375rem; }
.ch-item-top small { color: var(--text-light); font-size: .75rem; white-space: nowrap; }
.ch-item-text { color: var(--text-muted); font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; align-self: center; }
.ch-item .ct-pill { font-size: .6875rem; padding: .125rem .5rem; }
.ch-whobar { border-top: 1px solid var(--border-color); padding: .75rem 1rem; font-size: .8125rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-whobar b { color: var(--text-dark); }

.ch-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ch-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ch-head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color); }
.ch-title { flex: 1; min-width: 0; }
.ch-title b { display: block; color: var(--text-dark); font-size: 1.0625rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-title small { display: block; color: var(--text-light); font-size: .8125rem; }
.ch-back { display: none; width: 2.25rem; height: 2.25rem; border: 0; border-radius: 50%; background: #f1f5f9; cursor: pointer; align-items: center; justify-content: center; flex: none; }
.ch-back svg { width: 18px; height: 18px; fill: none; stroke: var(--text-dark); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }

.ch-newform { flex: 1; overflow-y: auto; padding: 1.25rem; }
.ch-newform textarea { min-height: 130px; }
/* New conversation: the cost estimate form, as a clear button above the topic */
.ch-est {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem;
    margin-bottom: 1.25rem; padding: .875rem 1rem; border-radius: 12px;
    background: var(--primary-gradient-soft); border: 1px solid rgba(79, 70, 229, .18);
}
.ch-est p { flex: 1 1 260px; margin: 0; font-size: .9375rem; color: var(--text-gray); line-height: 1.5; }
.ch-est b { color: var(--text-dark); }
.ch-est .btn { flex: 0 0 auto; background: #fff; color: var(--primary-color); border: 1.5px solid var(--primary-color); font-weight: 600; }
.ch-est .btn:hover { background: var(--primary-color); color: #fff; }

.ch-msgs { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: .25rem; background: linear-gradient(180deg, #fbfcfe, #fff); }
.ch-msgs .ct-msg { max-width: 78%; margin-bottom: .5rem; }
.ch-msgs .ct-msg.user { margin-left: auto; border-bottom-right-radius: 4px; }
.ch-msgs .ct-msg.admin, .ch-msgs .ct-msg.auto { margin-right: auto; border-bottom-left-radius: 4px; }
.ch-composer { display: flex; align-items: flex-end; gap: .625rem; padding: .875rem 1.25rem .25rem; border-top: 1px solid var(--border-color); }
.ch-composer textarea {
    flex: 1; resize: none; min-height: 44px; max-height: 160px; padding: .65rem .875rem; line-height: 1.45;
    border: 1px solid var(--border-color); border-radius: 22px; font: inherit; font-size: .9375rem; color: var(--text-dark);
}
.ch-composer textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.ch-composer .btn { border-radius: 22px; min-height: 44px; }
.ch-foot { padding: .25rem 1.25rem .75rem; min-height: 1.75rem; }
.ch-foot .ct-error { margin: 0; }
.ch-foot .ct-error:not([hidden]) + .ct-hint { display: none; }

@media (max-width: 760px) {
    .ch-app { grid-template-columns: 1fr; height: calc(100dvh - 14rem); min-height: 420px; }
    .ch-side { border-right: 0; }
    .ch-app:not(.show-main) .ch-main { display: none; }
    .ch-app.show-main .ch-side { display: none; }
    .ch-back { display: inline-flex; }
    .ch-head { padding: .75rem 1rem; }
    .ch-msgs { padding: 1rem; }
    .ch-msgs .ct-msg { max-width: 88%; }
    .ch-composer { padding: .75rem 1rem .25rem; }
    .ch-foot { padding: .25rem 1rem .5rem; }
    .ch-foot .ct-hint { display: none; }
    /* Signed in on a phone: the chat gets the room */
    .ct-hero:has(~ .ch-app:not([hidden])) p { display: none; }
    .ct-hero:has(~ .ch-app:not([hidden])) { margin-bottom: 1rem; }
}
