:root {
    --hd-bg: #fafaf8;
    --hd-surface: #ffffff;
    --hd-surface-soft: #f3f1ee;
    --hd-surface-warm: #f7f3ee;
    --hd-ink: #292929;
    --hd-charcoal: #414141;
    --hd-muted: #74716d;
    --hd-muted-2: #9b9690;
    --hd-orange: #da853c;
    --hd-orange-dark: #b96525;
    --hd-orange-soft: #f7e9dc;
    --hd-line: #e5e0da;
    --hd-line-strong: #d8d1ca;
    --hd-green: #247a52;
    --hd-green-soft: #e8f3ed;
    --hd-red: #b0443e;
    --hd-red-soft: #faecea;
    --hd-purple: #7654a6;
    --hd-slate: #667380;
    --hd-radius-lg: 24px;
    --hd-radius-md: 18px;
    --hd-radius-sm: 12px;
    --hd-shadow: 0 18px 50px rgba(41, 41, 41, .07);
    --hd-shadow-soft: 0 8px 26px rgba(41, 41, 41, .05);
    --hd-font: "Red Hat Display", "Prompt", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --hd-public-container: 1160px;
}

/* Phase 1B · Lead Pipeline and Tasks */
.pipeline-heading, .task-heading { align-items: center; }
.pipeline-summary, .task-summary { display: flex; align-items: stretch; overflow: hidden; border: 1px solid var(--hd-line); border-radius: 16px; background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.pipeline-summary span, .task-summary span { min-width: 118px; padding: 13px 17px; border-left: 1px solid var(--hd-line); }
.pipeline-summary span:first-child, .task-summary span:first-child { border-left: 0; }
.pipeline-summary small, .pipeline-summary strong, .task-summary small, .task-summary strong { display: block; }
.pipeline-summary small, .task-summary small { color: var(--hd-muted); font-size: .58rem; font-weight: 700; }
.pipeline-summary strong, .task-summary strong { margin-top: 4px; color: var(--hd-ink); font-size: 1rem; }
.task-summary .warning strong { color: var(--hd-orange-dark); }
.task-summary .danger strong { color: var(--hd-red); }

.pipeline-filters, .task-filters { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-md); background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.pipeline-filters { grid-template-columns: minmax(260px, 1fr) 180px 210px auto; margin-bottom: 16px; }
.task-filters { grid-template-columns: minmax(220px, 1fr) 145px 145px 165px auto; border: 0; border-bottom: 1px solid var(--hd-line); border-radius: 0; box-shadow: none; }
.pipeline-filters input, .pipeline-filters select, .task-filters input, .task-filters select { min-height: 40px; border-radius: 10px; font-size: .68rem; }
.pipeline-filters button, .task-filters button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px; color: #fff; background: var(--hd-charcoal); font-size: .67rem; font-weight: 800; cursor: pointer; }

.pipeline-board { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; margin: 0 -3px 20px; padding: 3px 3px 16px; scroll-snap-type: x proximity; }
.pipeline-column { width: 290px; min-width: 290px; overflow: hidden; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-md); background: var(--hd-surface-soft); scroll-snap-align: start; }
.pipeline-column > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px; border-bottom: 1px solid var(--hd-line); background: var(--hd-surface); }
.pipeline-column > header > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pipeline-column > header i { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--stage-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--stage-color) 14%, transparent); }
.pipeline-column > header strong { overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-column > header span { min-width: 21px; height: 21px; display: grid; place-items: center; border-radius: 999px; color: var(--hd-muted); background: var(--hd-surface-soft); font-size: .57rem; font-weight: 800; }
.pipeline-column > header small { color: var(--hd-muted); font-size: .58rem; font-weight: 700; white-space: nowrap; }
.pipeline-card-list { min-height: 190px; display: grid; align-content: start; gap: 9px; padding: 10px; transition: background .2s ease; }
.pipeline-column.drag-over .pipeline-card-list { background: var(--hd-orange-soft); }
.lead-card { overflow: hidden; border: 1px solid var(--hd-line); border-radius: 13px; background: var(--hd-surface); box-shadow: 0 5px 16px rgba(41, 41, 41, .04); transition: border-color .2s, box-shadow .2s, transform .2s, opacity .2s; }
.lead-card:hover, .lead-card.active { border-color: color-mix(in srgb, var(--stage-color) 48%, var(--hd-line)); box-shadow: 0 9px 22px rgba(41, 41, 41, .08); transform: translateY(-2px); }
.lead-card.dragging { opacity: .42; }
.lead-card-main { display: block; padding: 13px; }
.lead-card-top, .lead-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lead-card-top small { overflow: hidden; color: var(--hd-muted); font-size: .55rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.lead-card-top b { padding: 3px 6px; border-radius: 999px; color: var(--hd-muted); background: var(--hd-surface-soft); font-size: .49rem; text-transform: uppercase; }
.lead-card-main > strong { display: block; margin: 8px 0 5px; color: var(--hd-ink); font-size: .73rem; line-height: 1.4; }
.lead-contact { display: block; overflow: hidden; color: var(--hd-muted); font-size: .59rem; text-overflow: ellipsis; white-space: nowrap; }
.lead-meta { margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--hd-line); }
.lead-meta em { color: var(--hd-ink); font-size: .63rem; font-style: normal; font-weight: 800; }
.lead-meta small { color: var(--hd-muted); font-size: .55rem; }
.lead-follow-up { display: block; margin-top: 7px; color: var(--hd-muted-2); font-size: .54rem; }
.lead-follow-up.overdue { color: var(--hd-red); font-weight: 700; }
.lead-stage-form { padding: 0 10px 10px; }
.lead-stage-form select { min-height: 32px; padding: 0 8px; border-radius: 8px; color: var(--hd-muted); font-size: .58rem; }
.pipeline-empty { min-height: 126px; display: grid; place-items: center; padding: 18px; color: var(--hd-muted-2); font-size: .6rem; text-align: center; }

.pipeline-forms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pipeline-form-panel, .task-form-panel { align-self: start; }
.crm-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.crm-form-grid label > span { display: block; margin-bottom: 6px; color: var(--hd-charcoal); font-size: .65rem; font-weight: 700; }
.crm-form-grid .span-2 { grid-column: 1 / -1; }
.crm-form-grid input[type="text"], .crm-form-grid input[type="number"], .crm-form-grid input[type="datetime-local"], .crm-form-grid select, .crm-form-grid textarea { width: 100%; min-height: 43px; padding: 0 12px; border: 1px solid var(--hd-line-strong); border-radius: 10px; outline: none; color: var(--hd-ink); background: var(--hd-surface); font: inherit; font-size: .68rem; }
.crm-form-grid textarea { min-height: 84px; padding-top: 10px; resize: vertical; }
.crm-form-grid input:focus, .crm-form-grid select:focus, .crm-form-grid textarea:focus { border-color: var(--hd-orange); box-shadow: 0 0 0 4px rgba(218, 133, 60, .1); }
.panel-close { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--hd-line); border-radius: 50%; color: var(--hd-muted); background: var(--hd-surface); font-size: 1rem; }
.pipeline-detail-empty { min-height: 330px; display: grid; place-content: center; justify-items: center; text-align: center; }
.pipeline-detail-empty > span { width: 55px; height: 55px; display: grid; place-items: center; border-radius: 17px; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: 1.5rem; }
.pipeline-detail-empty h2 { margin-top: 14px; font-size: .92rem; }
.pipeline-detail-empty p { max-width: 330px; margin: 7px 0 0; font-size: .65rem; }

.task-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 16px; align-items: start; }
.task-list-panel { overflow: hidden; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-lg); background: var(--hd-surface); box-shadow: var(--hd-shadow); }
.task-records { display: grid; }
.task-record { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--hd-line); background: var(--hd-surface); transition: background .2s; }
.task-record:hover, .task-record.active { background: var(--hd-orange-soft); }
.task-record.completed { opacity: .7; }
.task-record > a { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) 120px; align-items: center; gap: 12px; padding: 15px 16px; }
.task-record-copy { min-width: 0; }
.task-record-copy > span { display: flex; align-items: center; gap: 8px; }
.task-record-copy strong { overflow: hidden; color: var(--hd-ink); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.task-record-copy small, .task-record-copy em { display: block; overflow: hidden; margin-top: 3px; color: var(--hd-muted); font-size: .58rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.task-record-copy em.overdue { color: var(--hd-red); font-weight: 700; }
.task-status { flex: 0 0 auto; padding: 3px 7px; border-radius: 999px; color: var(--hd-muted); background: var(--hd-surface-soft); font-size: .5rem; }
.task-status.status-in_progress { color: var(--hd-orange-dark); background: var(--hd-orange-soft); }
.task-status.status-completed { color: var(--hd-green); background: var(--hd-green-soft); }
.task-status.status-cancelled { color: var(--hd-red); background: var(--hd-red-soft); }
.task-record-owner { overflow: hidden; color: var(--hd-muted); font-size: .59rem; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.task-record > form { display: grid; align-items: center; padding-right: 14px; }
.task-record > form button { min-height: 31px; padding: 0 10px; border: 1px solid var(--hd-line); border-radius: 999px; color: var(--hd-muted); background: var(--hd-surface); font-size: .55rem; font-weight: 700; cursor: pointer; }
.task-record > form button.complete { color: var(--hd-green); border-color: #b9dfcf; background: var(--hd-green-soft); }
.task-empty { min-height: 390px; display: grid; place-content: center; justify-items: center; padding: 30px; text-align: center; }
.task-empty > span { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: var(--hd-green); background: var(--hd-green-soft); font-size: 1.5rem; }
.task-empty h2 { margin-top: 14px; font-size: .9rem; }
.task-empty p { max-width: 310px; margin: 6px 0 0; font-size: .64rem; }
.task-form-sidebar { display: grid; gap: 16px; }

@media (max-width: 1280px) {
    .pipeline-heading, .task-heading { align-items: flex-start; }
    .pipeline-summary, .task-summary { flex-wrap: wrap; }
    .task-workspace { grid-template-columns: minmax(0, 1fr) 360px; }
}

@media (max-width: 1000px) {
    .pipeline-heading, .task-heading { display: block; }
    .pipeline-summary, .task-summary { width: fit-content; margin-top: 16px; }
    .pipeline-filters { grid-template-columns: 1fr 1fr; }
    .task-workspace { grid-template-columns: 1fr; }
    .task-form-sidebar { grid-row: 1; grid-template-columns: 1fr 1fr; }
    .pipeline-forms-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .pipeline-summary, .task-summary { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
    .pipeline-summary span, .task-summary span { min-width: 0; border-bottom: 1px solid var(--hd-line); }
    .pipeline-filters, .task-filters { grid-template-columns: 1fr; }
    .pipeline-column { width: 82vw; min-width: 82vw; }
    .pipeline-forms-grid, .task-form-sidebar { grid-template-columns: 1fr; }
    .task-record { grid-template-columns: 1fr; }
    .task-record > a { grid-template-columns: auto minmax(0, 1fr); }
    .task-record-owner { grid-column: 2; text-align: left; }
    .task-record > form { padding: 0 14px 13px 42px; }
    .crm-form-grid { grid-template-columns: 1fr; }
    .crm-form-grid .span-2 { grid-column: auto; }
}

* { box-sizing: border-box; }
html { min-height: 100%; color-scheme: light; background: var(--hd-bg); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--hd-ink);
    background: var(--hd-bg);
    font-family: var(--hd-font);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; color: var(--hd-ink); font-weight: 700; line-height: 1.15; letter-spacing: -.025em; }
p { color: var(--hd-muted); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 276px minmax(0, 1fr); }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 28px 22px 22px;
    border-right: 1px solid var(--hd-line);
    background: var(--hd-surface);
    z-index: 10;
    overflow-y: auto;
}

.brand { display: inline-flex; align-items: center; gap: 13px; min-width: max-content; }
.brand-mark {
    width: 46px;
    height: 46px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    color: #ffffff;
    background: var(--hd-orange);
    box-shadow: 0 10px 24px rgba(218, 133, 60, .22);
    font-size: .83rem;
    font-weight: 900;
}
.brand strong { display: block; color: var(--hd-ink); font-size: 1.12rem; font-weight: 900; line-height: 1.15; letter-spacing: .01em; }
.brand small { display: block; margin-top: 4px; color: var(--hd-muted); font-size: .68rem; font-weight: 500; line-height: 1.1; letter-spacing: .04em; }

.workspace-card {
    margin: 30px 0 22px;
    padding: 18px;
    border: 1px solid var(--hd-line);
    border-radius: var(--hd-radius-md);
    background: var(--hd-surface-soft);
}
.workspace-card strong { display: block; margin: 7px 0 13px; color: var(--hd-ink); font-size: 1rem; font-weight: 700; }
.eyebrow { color: var(--hd-orange-dark); font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.role-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .61rem; font-weight: 900; letter-spacing: .1em; }

.main-nav { display: grid; gap: 5px; }
.nav-section-label { display: block; margin: 16px 14px 5px; color: rgba(101, 84, 67, .58); font: 800 .54rem/1.2 "Red Hat Display", sans-serif; letter-spacing: .14em; }
.nav-section-label:first-child { margin-top: 0; }
.main-nav a, .main-nav .disabled {
    min-height: 45px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--hd-charcoal);
    font-size: .86rem;
    font-weight: 600;
    transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease;
}
.main-nav a:hover { color: var(--hd-ink); border-color: var(--hd-line); background: var(--hd-surface-soft); transform: translateX(2px); }
.main-nav a.active { color: var(--hd-orange-dark); border-color: #f0d8c3; background: var(--hd-orange-soft); }
.main-nav .disabled { color: var(--hd-muted-2); cursor: default; }
.main-nav em { margin-left: auto; color: var(--hd-muted-2); font-size: .59rem; font-style: normal; font-weight: 500; }
.nav-icon { width: 21px; color: var(--hd-muted); text-align: center; font-size: .98rem; }
.main-nav a.active .nav-icon { color: var(--hd-orange); }
.sidebar-footer { display: flex; align-items: center; gap: 11px; margin-top: auto; padding: 18px 9px 2px; border-top: 1px solid var(--hd-line); }
.sidebar-footer strong, .sidebar-footer small { display: block; }
.sidebar-footer strong { color: var(--hd-charcoal); font-size: .7rem; font-weight: 700; }
.sidebar-footer small { margin-top: 2px; color: var(--hd-muted-2); font-size: .63rem; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--hd-green); box-shadow: 0 0 0 5px var(--hd-green-soft); }

.main-content { position: relative; min-width: 0; background: var(--hd-bg); }
.main-content::before { display: none; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 36px;
    border-bottom: 1px solid var(--hd-line);
    background: rgba(250, 250, 248, .94);
    backdrop-filter: blur(16px);
}
.topbar-context { color: var(--hd-muted); font-size: .72rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.mobile-brand { display: none; color: var(--hd-ink); font-weight: 900; }
.user-menu { display: flex; align-items: center; gap: 12px; }
.admin-language-switch, .auth-language-switch { display: inline-grid; place-items: center; border: 1px solid var(--hd-line-strong); border-radius: 999px; color: var(--hd-orange-dark); background: var(--hd-surface); font-size: .66rem; font-weight: 800; letter-spacing: .05em; box-shadow: var(--hd-shadow-soft); }
.admin-language-switch { width: 38px; height: 38px; }
.admin-language-switch:hover, .auth-language-switch:hover { border-color: var(--hd-orange); background: var(--hd-orange-soft); }
.user-avatar, .mini-avatar { display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-weight: 800; }
.user-avatar { width: 38px; height: 38px; font-size: .82rem; }
.user-copy strong, .user-copy span { display: block; }
.user-copy strong { color: var(--hd-ink); font-size: .76rem; font-weight: 700; }
.user-copy span { margin-top: 1px; color: var(--hd-muted); font-size: .65rem; }
.text-link, .logout-button { padding: 7px 10px; border: 1px solid transparent; border-radius: 999px; color: var(--hd-muted); background: none; font-size: .68rem; font-weight: 700; cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.text-link:hover, .logout-button:hover { color: var(--hd-orange-dark); border-color: var(--hd-line); background: var(--hd-surface); }
.mobile-nav { display: none; }

.page-wrap { position: relative; max-width: 1580px; margin: 0 auto; padding: 38px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 26px; }
.page-heading h1 { margin: 8px 0 7px; font-size: clamp(1.9rem, 2.6vw, 2.35rem); font-weight: 700; }
.page-heading p { margin: 0; color: var(--hd-muted); font-size: .88rem; line-height: 1.65; }
.compact-heading { align-items: flex-start; }
.date-chip { padding: 9px 14px; border: 1px solid var(--hd-line); border-radius: 999px; color: var(--hd-muted); background: var(--hd-surface); font-size: .68rem; font-weight: 600; }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(145px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
    --accent: var(--hd-orange);
    position: relative;
    overflow: hidden;
    min-height: 148px;
    padding: 20px;
    border: 1px solid var(--hd-line);
    border-radius: var(--hd-radius-md);
    background: var(--hd-surface);
    box-shadow: var(--hd-shadow-soft);
}
.stat-card::before { position: absolute; top: 0; right: 0; left: 0; height: 4px; content: ""; background: var(--accent); }
.stat-card::after { position: absolute; right: 18px; bottom: 18px; width: 8px; height: 8px; content: ""; border-radius: 50%; background: var(--accent); opacity: .75; }
.stat-card span { display: block; min-height: 38px; color: var(--hd-muted); font-size: .72rem; font-weight: 600; line-height: 1.5; }
.stat-card strong { display: block; margin: 8px 0 2px; color: var(--hd-ink); font-size: 2rem; font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.stat-card small { color: var(--hd-muted-2); font-size: .58rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; }
.accent-blue { --accent: #62818e; }
.accent-purple { --accent: var(--hd-purple); }
.accent-orange, .accent-gold { --accent: var(--hd-orange); }
.accent-green { --accent: var(--hd-green); }
.accent-slate { --accent: var(--hd-slate); }

.content-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.two-thirds { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.team-grid { grid-template-columns: minmax(0, 2fr) minmax(340px, .76fr); align-items: start; }
.panel {
    min-width: 0;
    padding: 23px;
    border: 1px solid var(--hd-line);
    border-radius: var(--hd-radius-lg);
    background: var(--hd-surface);
    box-shadow: var(--hd-shadow);
}
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.panel-heading h2 { margin-top: 5px; font-size: 1.18rem; font-weight: 700; }
.muted { color: var(--hd-muted); font-size: .7rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 13px; color: var(--hd-muted); font-size: .62rem; font-weight: 800; text-align: left; letter-spacing: .09em; text-transform: uppercase; background: var(--hd-surface-soft); }
th:first-child { border-radius: 11px 0 0 11px; }
th:last-child { border-radius: 0 11px 11px 0; }
td { padding: 15px 13px; border-bottom: 1px solid var(--hd-line); color: var(--hd-muted); font-size: .75rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .2s ease; }
tbody tr:hover { background: #fdfbf8; }
td strong { color: var(--hd-ink); font-weight: 600; }
.pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: var(--hd-green); background: var(--hd-green-soft); font-size: .61rem; font-weight: 800; }

.empty-state { min-height: 215px; display: grid; place-content: center; justify-items: center; color: var(--hd-muted-2); text-align: center; }
.empty-state span { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 18px; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: 1.4rem; }
.empty-state strong { color: var(--hd-charcoal); font-size: .82rem; font-weight: 600; }
.empty-state p { margin: 6px 0 0; color: var(--hd-muted); font-size: .66rem; }
.empty-state.small { min-height: 215px; }
.task-list { display: grid; gap: 10px; }
.task-item { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-sm); background: var(--hd-bg); }
.task-item strong, .task-item small { display: block; }
.task-item strong { color: var(--hd-ink); font-size: .75rem; font-weight: 600; }
.task-item small { margin-top: 3px; color: var(--hd-muted); font-size: .62rem; }
.priority { width: 8px; height: 8px; border-radius: 50%; background: var(--hd-muted); }
.priority-high, .priority-urgent { background: var(--hd-red); }
.priority-normal { background: var(--hd-orange); }
.priority-low { background: var(--hd-green); }

.dashboard-activity-panel { margin-bottom: 20px; }
.dashboard-activity-panel .panel-heading { align-items: flex-start; }
.dashboard-activity-intro { margin: 7px 0 0; color: var(--hd-muted); font-size: .68rem; line-height: 1.55; }
.dashboard-activity-list { overflow: hidden; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-md); background: var(--hd-surface); }
.dashboard-activity-item { min-width: 0; min-height: 86px; display: grid; grid-template-columns: 70px 42px minmax(0, 1fr) 22px; align-items: center; gap: 13px; padding: 13px 17px; border-bottom: 1px solid var(--hd-line); color: var(--hd-ink); transition: background .2s ease; }
.dashboard-activity-item:last-child { border-bottom: 0; }
.dashboard-activity-item:hover { background: #fdf9f4; }
.dashboard-activity-date { min-width: 0; display: grid; gap: 3px; padding-right: 13px; border-right: 1px solid var(--hd-line); }
.dashboard-activity-date strong, .dashboard-activity-date span { display: block; }
.dashboard-activity-date strong { color: var(--hd-charcoal); font-size: .62rem; font-weight: 800; }
.dashboard-activity-date span { color: var(--hd-muted-2); font-size: .55rem; font-weight: 700; }
.dashboard-activity-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .9rem; font-weight: 800; }
.activity-message-in .dashboard-activity-icon { color: #1877f2; background: #edf4ff; }
.activity-message-out .dashboard-activity-icon { color: var(--hd-purple); background: var(--hd-purple-soft); }
.activity-points .dashboard-activity-icon { color: var(--hd-orange-dark); background: var(--hd-orange-soft); }
.activity-task .dashboard-activity-icon { color: var(--hd-green); background: var(--hd-green-soft); }
.activity-lead .dashboard-activity-icon { color: #a65b18; background: #fff3e8; }
.activity-source .dashboard-activity-icon { color: var(--hd-slate); background: #edf2f4; }
.dashboard-activity-copy { min-width: 0; }
.dashboard-activity-meta { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.dashboard-activity-meta b { padding: 4px 7px; border-radius: 999px; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .49rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.dashboard-activity-copy > strong, .dashboard-activity-copy > small { display: block; }
.dashboard-activity-copy > strong { overflow: hidden; color: var(--hd-ink); font-size: .72rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-activity-copy > small { display: -webkit-box; overflow: hidden; margin-top: 5px; color: var(--hd-muted); font-size: .6rem; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.dashboard-activity-open { color: var(--hd-muted-2); font-size: 1.25rem; line-height: 1; text-align: right; }
.activity-view-all, .activity-back-link { color: var(--hd-charcoal); text-decoration: none; }
.activity-view-all:hover, .activity-back-link:hover { color: var(--hd-orange-dark); border-color: var(--hd-orange); }
.activity-log-panel { padding: 0; overflow: hidden; }
.activity-log-filter { min-height: 78px; display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 16px 20px; border-bottom: 1px solid var(--hd-line); background: var(--hd-surface-soft); }
.activity-log-filter label { width: min(320px, 100%); display: grid; gap: 6px; }
.activity-log-filter label span { color: var(--hd-muted); font-size: .56rem; font-weight: 800; }
.activity-log-filter select { min-height: 40px; padding: 0 11px; border: 1px solid var(--hd-line-strong); border-radius: 10px; color: var(--hd-ink); background: var(--hd-surface); font: inherit; font-size: .66rem; }
.activity-log-list { border: 0; border-radius: 0; }
.activity-log-panel .pagination-row { padding: 15px 20px; }

.alert { margin-bottom: 18px; padding: 14px 16px; border-radius: var(--hd-radius-sm); font-size: .76rem; }
.alert ul { margin: 7px 0 0; padding-left: 18px; }
.alert-success { color: var(--hd-green); border: 1px solid #cfe3d8; background: var(--hd-green-soft); }
.alert-danger { color: var(--hd-red); border: 1px solid #efcbc8; background: var(--hd-red-soft); }
.alert-warning { color: #8a531f; border: 1px solid #efd2b8; background: var(--hd-orange-soft); }
.notice { margin-bottom: 18px; padding: 14px 16px; border: 1px solid #efd2b8; border-left: 3px solid var(--hd-orange); border-radius: 10px; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .76rem; }
.narrow-panel { max-width: 620px; }

.stack-form { display: grid; gap: 16px; }
.stack-form label > span { display: block; margin-bottom: 7px; color: var(--hd-charcoal); font-size: .72rem; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], select {
    width: 100%;
    min-height: 47px;
    padding: 0 14px;
    border: 1px solid var(--hd-line-strong);
    border-radius: 12px;
    outline: none;
    color: var(--hd-ink);
    background: var(--hd-surface);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
input::placeholder { color: var(--hd-muted-2); }
input:focus, select:focus { border-color: var(--hd-orange); background: #fffdfa; box-shadow: 0 0 0 4px rgba(218, 133, 60, .12); }
select option { color: var(--hd-ink); background: var(--hd-surface); }
.primary-button, .small-button { border: 0; border-radius: 999px; color: #ffffff; background: var(--hd-orange); font-weight: 800; cursor: pointer; box-shadow: 0 10px 24px rgba(218, 133, 60, .18); transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }
.primary-button { min-height: 48px; padding: 0 23px; font-size: .8rem; }
.primary-button:hover, .small-button:hover { transform: translateY(-2px); background: var(--hd-orange-dark); box-shadow: 0 14px 30px rgba(185, 101, 37, .2); }
.small-button { min-height: 36px; padding: 0 13px; font-size: .66rem; }
.wide { width: 100%; }

.credential-box { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .8fr); gap: 25px; margin-bottom: 18px; padding: 21px; border: 1px solid #efd2b8; border-radius: var(--hd-radius-md); background: var(--hd-orange-soft); box-shadow: var(--hd-shadow-soft); }
.credential-box strong { display: block; margin: 8px 0; color: var(--hd-ink); font-size: .82rem; }
.credential-box code { display: inline-block; padding: 9px 13px; border: 1px solid #efd2b8; border-radius: 9px; color: var(--hd-orange-dark); background: var(--hd-surface); font-size: .86rem; font-weight: 700; letter-spacing: .04em; }
.credential-box p { margin: 0; align-self: center; color: var(--hd-muted); font-size: .72rem; line-height: 1.75; }
.member-cell { display: flex; align-items: center; gap: 11px; }
.member-cell strong, .member-cell small { display: block; }
.member-cell small { margin-top: 3px; color: var(--hd-muted); font-size: .62rem; }
.mini-avatar { width: 35px; height: 35px; font-size: .7rem; }
.member-form { display: grid; grid-template-columns: minmax(95px, 1fr) auto auto; align-items: center; gap: 8px; }
.member-form select { min-height: 36px; padding: 0 9px; font-size: .68rem; }
.switch-label { display: flex; align-items: center; gap: 6px; color: var(--hd-muted); font-size: .62rem; white-space: nowrap; }
.switch-label input { accent-color: var(--hd-green); }
.member-status-static { display: flex; align-items: center; gap: 9px; }
.role-pill { padding: 5px 9px; border-radius: 999px; color: var(--hd-charcoal); background: var(--hd-surface-soft); font-size: .58rem; font-weight: 900; }
.role-owner { color: var(--hd-orange-dark); background: var(--hd-orange-soft); }
.role-admin { color: #526d79; background: #eaf0f2; }
.active-text, .inactive-text { font-size: .62rem; font-weight: 700; }
.active-text { color: var(--hd-green); }
.inactive-text { color: var(--hd-red); }
.add-member-panel { position: sticky; top: 96px; }
.role-guide { margin-top: 23px; padding-top: 19px; border-top: 1px solid var(--hd-line); }
.role-guide h3 { margin: 0 0 11px; font-size: .76rem; }
.role-guide p { margin: 7px 0; color: var(--hd-muted); font-size: .64rem; }
.role-guide strong { color: var(--hd-ink); font-weight: 700; }

.auth-body {
    position: relative;
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 80px 28px;
    background: radial-gradient(circle at 12% 8%, rgba(218, 133, 60, .11), transparent 30%), var(--hd-bg);
}
.auth-back-home { position: fixed; z-index: 20; top: 38px; left: 42px; display: inline-flex; align-items: center; gap: 7px; color: var(--hd-muted); font-size: .76rem; font-weight: 600; }
.auth-back-home:hover { color: var(--hd-orange-dark); }
.auth-language-switch { position: fixed; z-index: 5; top: 24px; right: 40px; min-width: 48px; height: 48px; padding: 0 12px; }
.auth-shell { width: min(1240px, 100%); min-height: 720px; display: grid; grid-template-columns: 1.08fr .92fr; overflow: hidden; border: 1px solid var(--hd-line); border-radius: 30px; background: var(--hd-surface); box-shadow: 0 28px 80px rgba(41, 41, 41, .09); }
.auth-brand-panel { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 54px 58px; border-right: 1px solid var(--hd-line); background: var(--hd-surface-warm); }
.auth-brand-panel::before { position: absolute; right: -105px; bottom: -185px; width: 660px; height: 660px; content: ""; border: 105px solid rgba(218, 133, 60, .1); border-radius: 50%; }
.auth-brand-panel::after { position: absolute; top: 28%; right: 13%; width: 105px; height: 105px; content: ""; border-radius: 32px; background: rgba(218, 133, 60, .11); transform: rotate(18deg); }
.brand-light, .auth-message, .auth-feature-row { position: relative; z-index: 1; }
.auth-message { max-width: 680px; }
.auth-message h1 { margin: 22px 0 25px; font-size: clamp(3.15rem, 4.5vw, 4.65rem); font-weight: 700; line-height: 1.01; letter-spacing: -.055em; }
html[lang="th"] .auth-message h1 { font-size: clamp(2.75rem, 3.9vw, 4.05rem); line-height: 1.07; }
.auth-message p { max-width: 540px; margin: 0; color: var(--hd-muted); font-size: .86rem; line-height: 1.75; }
.auth-feature-row { display: flex; flex-wrap: wrap; gap: 8px; }
.auth-feature-row span { padding: 7px 11px; border: 1px solid var(--hd-line-strong); border-radius: 999px; color: var(--hd-charcoal); background: rgba(255, 255, 255, .7); font-size: .61rem; font-weight: 800; letter-spacing: .09em; }
.auth-form-panel { display: grid; place-items: center; padding: 60px; background: var(--hd-surface); }
.auth-form-wrap { width: min(430px, 100%); }
.auth-form-wrap h2 { margin: 13px 0 9px; font-size: 3rem; font-weight: 700; }
.auth-form-wrap > .muted { display: block; margin-bottom: 34px; font-size: .84rem; }
.auth-form-wrap .stack-form { gap: 18px; }
.auth-form-wrap .stack-form label > span { margin-bottom: 9px; font-size: .78rem; }
.auth-form-wrap input[type="email"], .auth-form-wrap input[type="password"] { min-height: 54px; padding: 0 18px; border-radius: 13px; font-size: .76rem; }
.auth-form-wrap .primary-button { min-height: 48px; font-size: .78rem; }
.auth-switch { margin: 20px 0 0; color: var(--hd-muted); font-size: .72rem; text-align: center; }
.auth-switch a { color: var(--hd-orange-dark); font-weight: 800; }
.registration-body { align-items: flex-start; overflow-y: auto; padding-top: 42px; padding-bottom: 42px; }
.registration-shell { width: min(1180px, 100%); min-height: 760px; }
.registration-brand-panel { min-height: 760px; }
.registration-form-panel { padding: 42px 48px; }
.registration-form-wrap { width: min(470px, 100%); }
.registration-form-wrap > .muted { margin-bottom: 20px; }
.registration-form { gap: 13px; }
.registration-password-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.registration-feature-list { position: relative; z-index: 1; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 11px 13px; }
.registration-feature-list span { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--hd-line-strong); border-radius: 50%; color: var(--hd-orange-dark); background: rgba(255, 255, 255, .72); font-size: .58rem; font-weight: 800; }
.registration-feature-list strong { color: var(--hd-charcoal); font-size: .72rem; }
.registration-terms { align-items: flex-start; margin-top: 4px; }
.registration-terms span { line-height: 1.55; }
.registration-honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.form-help { display: block; margin: -5px 0 2px; color: var(--hd-muted-2); font-size: .61rem; line-height: 1.5; }
.check-row { display: flex !important; align-items: center; gap: 8px; }
.check-row input { width: 15px; height: 15px; accent-color: var(--hd-orange); }
.check-row span { margin: 0 !important; color: var(--hd-muted) !important; font-weight: 500 !important; }
.security-note { margin: 23px 0 0; color: var(--hd-muted-2); font-size: .62rem; line-height: 1.65; text-align: center; }

@media (max-width: 1270px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1000px) {
    .app-shell { display: block; }
    .sidebar { display: none; }
    .mobile-brand { display: inline; margin-right: 11px; }
    .topbar { padding: 0 21px; }
    .mobile-nav { position: sticky; top: 78px; z-index: 7; display: flex; gap: 7px; overflow-x: auto; padding: 10px 20px; border-bottom: 1px solid var(--hd-line); background: rgba(250, 250, 248, .96); backdrop-filter: blur(16px); }
    .mobile-nav a { padding: 7px 12px; border: 1px solid transparent; border-radius: 999px; color: var(--hd-muted); font-size: .67rem; font-weight: 700; white-space: nowrap; }
    .mobile-nav a.active { color: #ffffff; background: var(--hd-orange); }
    .page-wrap { padding: 27px 21px; }
    .two-thirds, .team-grid { grid-template-columns: 1fr; }
    .add-member-panel { position: static; }
    .auth-body { padding: 84px 24px 28px; }
    .auth-shell { min-height: 0; grid-template-columns: 1fr; }
    .auth-brand-panel { min-height: 325px; border-right: 0; border-bottom: 1px solid var(--hd-line); }
    .auth-feature-row { display: none; }
    .auth-message h1 { font-size: 2.7rem; }
    .auth-form-panel { padding: 44px 29px; }
    .registration-brand-panel { min-height: 390px; }
    .registration-feature-list { display: none; }
}

@media (max-width: 680px) {
    body { font-size: 14px; }
    .topbar-context, .user-copy, .text-link { display: none; }
    .page-heading { display: block; }
    .page-heading h1 { font-size: 1.78rem; }
    .date-chip { display: inline-block; margin-top: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-card { min-height: 138px; padding: 17px; }
    .stat-card strong { font-size: 1.75rem; }
    .dashboard-activity-panel .panel-heading { display: block; }
    .dashboard-activity-panel .panel-heading .date-chip { margin-top: 13px; }
    .dashboard-activity-item { grid-template-columns: 58px 40px minmax(0, 1fr) 15px; gap: 10px; padding: 13px; }
    .dashboard-activity-date { padding-right: 9px; }
    .dashboard-activity-icon { width: 40px; height: 40px; }
    .panel { padding: 18px; border-radius: var(--hd-radius-md); }
    .credential-box { grid-template-columns: 1fr; }
    .member-form { min-width: 310px; }
    .auth-body { padding: 0; }
    .auth-shell { min-height: 100vh; border: 0; border-radius: 0; }
    .auth-brand-panel { min-height: 280px; padding: 29px; }
    .auth-message h1 { font-size: 2.25rem; }
    .auth-message p { font-size: .78rem; }
    .auth-form-panel { padding: 40px 25px; }
    .auth-back-home { top: 18px; left: 18px; color: var(--hd-charcoal); }
    .auth-language-switch { top: 14px; right: 14px; height: 38px; }
    .registration-body { padding: 0; }
    .registration-password-grid { grid-template-columns: 1fr; }
    .activity-log-filter { align-items: stretch; flex-direction: column; }
}

/* Shared Inbox */
.inbox-page-heading { align-items: center; }
.line-live-badge { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--hd-line); border-radius: 999px; color: var(--hd-muted); background: var(--hd-surface); font-size: .66rem; font-weight: 700; }
.line-live-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--hd-orange); box-shadow: 0 0 0 4px var(--hd-orange-soft); }
.line-live-badge.live { color: var(--hd-green); border-color: #b9dfcf; background: var(--hd-green-soft); }
.line-live-badge.live i { background: var(--hd-green); box-shadow: 0 0 0 4px rgba(17, 139, 92, .12); }
.inbox-shell { min-height: calc(100vh - 220px); display: grid; grid-template-columns: 390px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-lg); background: var(--hd-surface); box-shadow: var(--hd-shadow); }
.conversation-panel { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--hd-line); background: #fdfcf9; }
.inbox-filters { padding: 17px; border-bottom: 1px solid var(--hd-line); }
.inbox-filters input[type="search"] { width: 100%; min-height: 43px; padding: 0 13px; border: 1px solid var(--hd-line-strong); border-radius: 11px; outline: none; color: var(--hd-ink); background: var(--hd-surface); font: inherit; font-size: .72rem; }
.inbox-filters input[type="search"]:focus { border-color: var(--hd-orange); box-shadow: 0 0 0 4px rgba(218, 133, 60, .1); }
.filter-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 7px; margin-top: 8px; }
.filter-row select { min-height: 36px; padding: 0 8px; border-radius: 9px; font-size: .63rem; }
.filter-row button { padding: 0 12px; border: 0; border-radius: 9px; color: #fff; background: var(--hd-charcoal); font-size: .63rem; font-weight: 700; cursor: pointer; }
.conversation-list { flex: 1; overflow-y: auto; }
.conversation-row { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 11px; padding: 15px 17px; border-bottom: 1px solid var(--hd-line); transition: background .2s ease; }
.conversation-row:hover { background: var(--hd-surface-soft); }
.conversation-row.active { background: var(--hd-orange-soft); box-shadow: inset 3px 0 var(--hd-orange); }
.conversation-avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .72rem; font-weight: 800; }
.conversation-row.active .conversation-avatar { color: #fff; background: var(--hd-orange); }
.conversation-copy { min-width: 0; display: block; }
.conversation-copy > span { display: flex; justify-content: space-between; gap: 8px; }
.conversation-copy strong { overflow: hidden; color: var(--hd-ink); font-size: .7rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.conversation-copy time { color: var(--hd-muted-2); font-size: .56rem; }
.conversation-copy small { display: block; overflow: hidden; margin-top: 3px; color: var(--hd-muted); font-size: .63rem; text-overflow: ellipsis; white-space: nowrap; }
.conversation-copy em { display: block; margin-top: 5px; color: var(--hd-orange-dark); font-size: .55rem; font-style: normal; font-weight: 600; }
.channel-dot { width: 7px; height: 7px; display: inline-block; margin-right: 5px; border-radius: 50%; background: var(--hd-muted-2); vertical-align: 1px; }
.channel-line { background: #06c755; }
.channel-web_form, .channel-web_chat { background: var(--hd-orange); }
.channel-email { background: #4978d1; }
.channel-facebook { background: #1877f2; }
.channel-instagram { background: #c13584; }
.channel-tiktok { background: #111; box-shadow: 2px 0 #25f4ee, -2px 0 #fe2c55; }
.channel-cdp, .channel-api, .channel-mobile_app { background: var(--hd-purple); }
.conversation-row > b { min-width: 19px; height: 19px; display: grid; place-items: center; align-self: center; border-radius: 999px; color: #fff; background: var(--hd-orange); font-size: .55rem; }
.conversation-empty { min-height: 330px; display: grid; place-content: center; justify-items: center; padding: 25px; text-align: center; }
.conversation-empty > span { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 17px; color: var(--hd-orange); background: var(--hd-orange-soft); font-size: 1.4rem; }
.conversation-empty strong { margin-top: 13px; font-size: .78rem; }
.conversation-empty p { max-width: 230px; margin: 5px 0 0; font-size: .62rem; }
.inbox-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--hd-line); color: var(--hd-muted-2); font-size: .6rem; }
.inbox-pagination a { color: var(--hd-orange-dark); font-weight: 700; }
.thread-panel { min-width: 0; display: flex; flex-direction: column; background: var(--hd-bg); }
.thread-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 18px; border-bottom: 1px solid var(--hd-line); background: var(--hd-surface); }
.thread-identity { display: flex; align-items: center; gap: 11px; min-width: 0; color: inherit; text-decoration: none; }
.thread-identity:hover strong { color: var(--hd-orange); }
.conversation-avatar.large { width: 43px; height: 43px; font-size: .78rem; }
.conversation-avatar img { width: 100%; height: 100%; display: block; border-radius: inherit; object-fit: cover; }
.thread-identity strong, .thread-identity small { display: block; }
.thread-identity strong { color: var(--hd-ink); font-size: .78rem; }
.thread-identity small { margin-top: 3px; color: var(--hd-muted); font-size: .62rem; }
.thread-actions { display: flex; align-items: center; gap: 7px; }
.thread-actions select { width: auto; min-height: 36px; padding: 0 9px; font-size: .64rem; }
.message-stream { flex: 1; min-height: 430px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 25px; background: linear-gradient(180deg, #fafaf8, #f6f3ef); }
.thread-start { display: flex; align-items: center; gap: 12px; margin: 5px 0 14px; color: var(--hd-muted-2); font-size: .56rem; }
.thread-start::before, .thread-start::after { height: 1px; flex: 1; content: ""; background: var(--hd-line); }
.message-bubble { max-width: min(72%, 640px); padding: 10px 13px 8px; border: 1px solid var(--hd-line); border-radius: 15px 15px 15px 4px; background: var(--hd-surface); box-shadow: 0 5px 16px rgba(41, 41, 41, .04); }
.message-bubble.outbound { align-self: flex-end; border-color: #efd2b8; border-radius: 15px 15px 4px 15px; background: var(--hd-orange-soft); }
.message-bubble p { margin: 0; color: var(--hd-ink); font-size: .75rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-bubble .non-text-message { color: var(--hd-muted); font-size: .65rem; font-weight: 700; letter-spacing: .06em; }
.web-form-message { display: grid; gap: 6px; margin: 10px 0 0; padding-top: 9px; border-top: 1px solid var(--hd-line); }
.web-form-message div { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 9px; }
.web-form-message dt { color: var(--hd-muted-2); font-size: .55rem; font-weight: 800; text-transform: uppercase; }
.web-form-message dd { margin: 0; color: var(--hd-ink); font-size: .64rem; overflow-wrap: anywhere; }
.rich-message-label { display: block; margin-bottom: 8px; color: var(--hd-muted-2); font-size: .5rem; font-weight: 900; letter-spacing: .1em; }
.line-rich-message { width: min(340px, 100%); }
.line-rich-carousel { max-width: min(340px, 66vw); display: flex; gap: 8px; overflow-x: auto; padding: 1px 1px 7px; scroll-snap-type: x mandatory; }
.line-rich-card { width: min(242px, 58vw); flex: 0 0 auto; overflow: hidden; border: 1px solid var(--hd-line); border-radius: 12px; background: var(--rich-card-bg, #fff); box-shadow: 0 6px 18px rgba(41, 41, 41, .07); scroll-snap-align: start; }
.line-rich-card > img { width: 100%; max-height: 154px; aspect-ratio: 1.62; display: block; object-fit: cover; }
.line-rich-card-body { display: grid; gap: 4px; padding: 10px; }
.line-rich-card-body > strong { color: var(--hd-ink); font-size: .69rem; line-height: 1.35; }
.line-rich-card-body > p { color: var(--hd-muted); font-size: .56rem; line-height: 1.45; }
.line-rich-actions { display: grid; gap: 5px; margin-top: 6px; }
.line-rich-actions a, .line-rich-actions span { min-height: 30px; display: grid; place-items: center; padding: 6px 9px; border-radius: 8px; color: #fff; background: var(--hd-ink); font-size: .55rem; font-weight: 800; text-align: center; }
.line-rich-actions span { color: var(--hd-muted); background: var(--hd-bg); }
.social-attachment-list { width: min(330px, 64vw); display: grid; gap: 7px; margin-top: 8px; }
.social-attachment-list img, .social-attachment-list video { width: 100%; max-height: 260px; display: block; border-radius: 11px; object-fit: cover; }
.social-attachment-list audio { width: 100%; max-width: 300px; }
.line-imagemap { width: min(340px, 64vw); }
.line-imagemap > img { width: 100%; display: block; border-radius: 12px; }
.line-media-preview { display: block; width: min(460px, 62vw); }
.line-media-preview img { width: 100%; max-height: 520px; display: block; border-radius: 11px; object-fit: contain; background: #eee; }
.line-video { width: min(500px, 64vw); max-height: 500px; display: block; border-radius: 11px; background: #111; }
.line-audio { width: min(360px, 58vw); display: block; }
.line-file { min-width: 240px; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--hd-line); border-radius: 10px; color: var(--hd-ink); background: var(--hd-surface); }
.line-file > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--hd-orange); }
.line-file strong { font-size: .63rem; overflow-wrap: anywhere; }
.line-sticker { width: 150px; max-width: 42vw; display: block; }
.line-location { min-width: 240px; }
.line-location strong { display: block; color: var(--hd-ink); font-size: .72rem; }
.line-location p { margin-top: 4px; color: var(--hd-muted); font-size: .62rem; }
.line-location a { display: inline-block; margin-top: 8px; color: var(--hd-orange-dark); font-size: .61rem; font-weight: 800; }
.message-bubble footer { display: flex; justify-content: flex-end; gap: 7px; margin-top: 5px; color: var(--hd-muted-2); font-size: .52rem; }
.message-bubble footer span { margin-right: auto; }
.message-bubble footer em { font-style: normal; font-weight: 700; }
.delivery-queued { color: var(--hd-orange-dark); }
.delivery-failed { color: var(--hd-red); }
.thread-no-messages { margin: auto; color: var(--hd-muted); font-size: .7rem; }
.reply-area { padding: 15px 18px; border-top: 1px solid var(--hd-line); background: var(--hd-surface); }
.reply-area > p { margin: 0; padding: 12px; border-radius: 10px; color: var(--hd-muted); background: var(--hd-surface-soft); font-size: .67rem; text-align: center; }
.reply-area textarea { width: 100%; resize: vertical; padding: 12px 13px; border: 1px solid var(--hd-line-strong); border-radius: 12px; outline: none; color: var(--hd-ink); background: var(--hd-surface); font: inherit; font-size: .72rem; }
.reply-area textarea:focus { border-color: var(--hd-orange); box-shadow: 0 0 0 4px rgba(218, 133, 60, .1); }
.facebook-composer-type { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.facebook-composer-type label, .facebook-composer-fields label { color: var(--hd-muted); font-size: .6rem; font-weight: 700; }
.facebook-composer-type select { min-width: 160px; padding: 8px 34px 8px 10px; border: 1px solid var(--hd-line-strong); border-radius: 10px; background: var(--hd-surface); color: var(--hd-ink); font: inherit; font-size: .65rem; }
.facebook-composer-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.facebook-composer-fields:has(label:only-child) { grid-template-columns: 1fr; }
.facebook-composer-fields label { display: grid; gap: 5px; }
.facebook-composer-fields input { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--hd-line-strong); border-radius: 10px; background: var(--hd-surface); color: var(--hd-ink); font: inherit; font-size: .65rem; }
.facebook-composer-fields input:focus { border-color: var(--hd-orange); outline: none; box-shadow: 0 0 0 4px rgba(218, 133, 60, .1); }
.reply-area form > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 8px; }
.reply-area form small { color: var(--hd-muted-2); font-size: .56rem; }
.reply-area .primary-button { min-height: 38px; padding: 0 18px; font-size: .67rem; }
@media (max-width: 720px) { .facebook-composer-fields { grid-template-columns: 1fr; } }
.thread-placeholder { min-height: 600px; display: grid; place-content: center; justify-items: center; text-align: center; }
.thread-placeholder > span { width: 70px; height: 70px; display: grid; place-items: center; border-radius: 23px; color: var(--hd-orange); background: var(--hd-orange-soft); font-size: 2rem; }
.thread-placeholder h2 { margin-top: 17px; font-size: 1.2rem; }
.thread-placeholder p { margin: 5px 0 0; font-size: .72rem; }

/* Public CRM landing */
.public-body { background: var(--hd-bg); font-size: 16px; }
html[lang="th"] .public-body { font-family: "Prompt", "Red Hat Display", system-ui, sans-serif; }
.public-header { width: min(var(--hd-public-container), calc(100% - 40px)); height: 90px; display: flex; align-items: center; gap: 42px; margin: 0 auto; border-bottom: 1px solid var(--hd-line); }
.public-header .brand strong { font-size: 1.2rem; }
.public-header .brand small { font-size: .75rem; }
.public-nav { display: flex; align-items: center; gap: 28px; margin-left: auto; }
.public-nav a { color: var(--hd-charcoal); font-size: .88rem; font-weight: 600; }
.public-nav a:hover { color: var(--hd-orange-dark); }
.public-actions { display: flex; align-items: center; gap: 10px; }
.public-signup { min-height: 42px; display: inline-flex; align-items: center; padding: 0 18px; border-radius: 999px; color: #fff; background: var(--hd-orange); font-size: .78rem; font-weight: 800; }
.public-signup:hover { background: var(--hd-orange-dark); }
.language-switch { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .76rem; font-weight: 800; }
.outline-button { min-height: 42px; display: inline-flex; align-items: center; padding: 0 19px; border: 1px solid var(--hd-charcoal); border-radius: 999px; color: var(--hd-charcoal); font-size: .82rem; font-weight: 700; }
.outline-button:hover { color: #fff; background: var(--hd-charcoal); }
.public-hero { width: min(var(--hd-public-container), calc(100% - 40px)); min-height: 750px; display: grid; grid-template-columns: minmax(0, .84fr) minmax(540px, 1.16fr); align-items: center; gap: clamp(40px, 6vw, 78px); margin: 0 auto; padding: 90px 0 105px; }
.public-eyebrow { color: var(--hd-orange-dark); font-size: .76rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.hero-copy h1 { max-width: 760px; margin: 20px 0 24px; font-size: clamp(3.25rem, 5.6vw, 6.35rem); font-weight: 700; line-height: .98; letter-spacing: -.055em; }
html[lang="th"] .hero-copy h1 { max-width: 680px; font-size: clamp(3.1rem, 4.5vw, 4.9rem); line-height: 1.04; letter-spacing: -.045em; }
.hero-copy p { max-width: 680px; margin: 0; color: var(--hd-muted); font-size: clamp(1.02rem, 1.35vw, 1.25rem); line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; margin-top: 34px; }
.public-primary, .public-secondary { min-height: 54px; display: inline-flex; align-items: center; justify-content: center; padding: 0 26px; border-radius: 999px; font-size: .88rem; font-weight: 800; transition: transform .2s ease, background .2s ease; }
.public-primary { color: #fff; background: var(--hd-orange); box-shadow: 0 13px 28px rgba(218, 133, 60, .2); }
.public-primary:hover { transform: translateY(-2px); background: var(--hd-orange-dark); }
.public-secondary { gap: 10px; color: var(--hd-charcoal); background: var(--hd-surface-soft); }
.public-secondary:hover { transform: translateY(-2px); }
.product-preview { overflow: hidden; border: 1px solid var(--hd-line); border-radius: 28px; background: var(--hd-surface); box-shadow: 0 28px 90px rgba(41, 41, 41, .12); transform: none; }
.preview-topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--hd-line); }
.preview-topbar > div { display: flex; align-items: center; gap: 10px; }
.preview-topbar strong { font-size: .84rem; }
.preview-logo { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--hd-orange); font-size: .62rem; font-weight: 900; }
.preview-status { display: flex; align-items: center; gap: 7px; color: var(--hd-muted); font-size: .7rem; font-weight: 600; }
.preview-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--hd-green); box-shadow: 0 0 0 4px var(--hd-green-soft); }
.preview-grid { min-height: 470px; display: grid; grid-template-columns: 42% 58%; }
.preview-list { padding: 16px 0; border-right: 1px solid var(--hd-line); background: #fdfcf9; }
.preview-search { height: 34px; margin: 0 14px 12px; border: 1px solid var(--hd-line); border-radius: 10px; background: var(--hd-surface); }
.preview-contact { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; padding: 13px 14px; border-top: 1px solid transparent; border-bottom: 1px solid transparent; }
.preview-contact.active { border-color: #efd2b8; background: var(--hd-orange-soft); }
.preview-contact > span, .thread-person > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .72rem; font-weight: 800; }
.preview-contact.active > span { color: #fff; background: var(--hd-orange); }
.preview-contact strong, .preview-contact small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-contact strong { color: var(--hd-ink); font-size: .72rem; }
.preview-contact small { margin-top: 3px; color: var(--hd-muted); font-size: .63rem; }
.preview-contact b { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--hd-orange); font-size: .56rem; }
.preview-contact.muted-row { opacity: .64; }
.preview-thread { display: flex; flex-direction: column; min-width: 0; }
.thread-person { height: 64px; display: flex; align-items: center; gap: 9px; padding: 0 16px; border-bottom: 1px solid var(--hd-line); }
.thread-person strong, .thread-person small { display: block; }
.thread-person strong { font-size: .74rem; }
.thread-person small { margin-top: 3px; color: var(--hd-muted); font-size: .62rem; }
.thread-space { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 28px 19px; background: var(--hd-bg); }
.bubble { max-width: 82%; padding: 12px 14px; border: 1px solid var(--hd-line); border-radius: 14px 14px 14px 4px; color: var(--hd-charcoal); background: var(--hd-surface); font-size: .7rem; line-height: 1.6; }
.bubble.outbound { align-self: flex-end; border-color: #efd2b8; border-radius: 14px 14px 4px 14px; background: var(--hd-orange-soft); }
.points-chip { align-self: flex-end; padding: 7px 10px; border-radius: 999px; color: var(--hd-green); background: var(--hd-green-soft); font-size: .6rem; font-weight: 700; }
.preview-composer { height: 65px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-top: 1px solid var(--hd-line); }
.preview-composer > span { flex: 1; padding-left: 12px; color: var(--hd-muted-2); font-size: .67rem; }
.preview-composer i { width: 26px; height: 7px; border-radius: 999px; background: var(--hd-line); }
.preview-composer button { width: 33px; height: 33px; border: 0; border-radius: 50%; color: #fff; background: var(--hd-orange); }
.public-trust { width: min(var(--hd-public-container), calc(100% - 40px)); display: grid; grid-template-columns: .8fr 1.2fr; gap: 70px; margin: 0 auto; padding: 36px 0 80px; border-top: 1px solid var(--hd-line); }
.public-trust strong { max-width: 500px; font-size: clamp(1.3rem, 2vw, 2rem); line-height: 1.3; }
.public-trust p { max-width: 760px; margin: 0; font-size: 1rem; line-height: 1.85; }
.public-section { width: min(var(--hd-public-container), calc(100% - 40px)); margin: 0 auto; padding: 110px 0; }
.section-heading { max-width: 830px; margin-bottom: 50px; }
.section-heading h2 { margin: 15px 0 18px; font-size: clamp(2.2rem, 4.3vw, 4.7rem); line-height: 1.03; letter-spacing: -.045em; }
.section-heading p { max-width: 780px; margin: 0; font-size: 1rem; line-height: 1.85; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--hd-line); border-left: 1px solid var(--hd-line); }
.feature-grid article { position: relative; min-height: 300px; padding: 29px; border-right: 1px solid var(--hd-line); border-bottom: 1px solid var(--hd-line); background: var(--hd-surface); }
.feature-grid article > span { color: var(--hd-muted-2); font-size: .72rem; font-weight: 800; }
.feature-grid article > i { position: absolute; top: 24px; right: 27px; width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid #efd2b8; border-radius: 18px; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-style: normal; }
.feature-grid article > i svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.feature-grid h3 { margin: 100px 0 12px; font-size: 1.42rem; }
.feature-grid p { margin: 0; font-size: .92rem; line-height: 1.75; }
.integration-section { padding: 115px max(20px, calc((100vw - var(--hd-public-container)) / 2)); background: var(--hd-surface-soft); }
.integration-cloud { display: flex; flex-wrap: wrap; gap: 13px; max-width: 1160px; }
.integration-cloud span { min-height: 60px; display: inline-flex; align-items: center; padding: 0 25px; border: 1px solid var(--hd-line-strong); border-radius: 999px; color: var(--hd-charcoal); background: rgba(255, 255, 255, .72); font-size: .9rem; font-weight: 700; }
.integration-cloud span.live { color: #fff; border-color: var(--hd-orange); background: var(--hd-orange); }
.integration-cloud span.planned { color: var(--hd-muted); border-style: dashed; background: transparent; }
.roadmap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.roadmap-grid article { min-height: 260px; padding: 27px; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-lg); background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.roadmap-grid article.current { border-color: #efd2b8; background: var(--hd-orange-soft); }
.roadmap-grid article > span { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 50%; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .72rem; font-weight: 800; }
.roadmap-grid article.current > span { color: #fff; background: var(--hd-orange); }
.roadmap-grid small { display: block; margin-top: 42px; color: var(--hd-orange-dark); font-size: .7rem; font-weight: 800; letter-spacing: .11em; }
.roadmap-grid h3 { margin: 9px 0 10px; font-size: 1.34rem; }
.roadmap-grid p { margin: 0; font-size: .9rem; line-height: 1.75; }
.public-cta { width: min(var(--hd-public-container), calc(100% - 40px)); margin: 30px auto 110px; padding: clamp(45px, 7vw, 90px); border-radius: 32px; background: var(--hd-orange-soft); text-align: center; }
.public-cta h2 { max-width: 1000px; margin: 18px auto; font-size: clamp(2.1rem, 4.4vw, 4.8rem); line-height: 1.05; letter-spacing: -.045em; }
.public-cta p { max-width: 720px; margin: 0 auto 30px; font-size: 1rem; line-height: 1.8; }
.public-cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.public-footer { width: min(var(--hd-public-container), calc(100% - 40px)); display: flex; align-items: center; justify-content: space-between; gap: 30px; margin: 0 auto; padding: 35px 0 50px; border-top: 1px solid var(--hd-line); color: var(--hd-muted); font-size: .78rem; }

@media (max-width: 1120px) {
    .inbox-shell { grid-template-columns: 340px minmax(0, 1fr); }
    .thread-header { align-items: flex-start; flex-direction: column; }
    .thread-actions { width: 100%; }
    .thread-actions select { min-width: 0; flex: 1; }
    .public-hero { grid-template-columns: 1fr; padding-top: 70px; }
    .hero-copy { max-width: 850px; }
    .product-preview { width: min(800px, 100%); margin: 0 auto; transform: none; }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 800px) {
    .inbox-page-heading .line-live-badge { margin-top: 15px; }
    .inbox-shell { display: block; min-height: 0; }
    .conversation-panel { max-height: 470px; border-right: 0; border-bottom: 1px solid var(--hd-line); }
    .thread-panel { min-height: 640px; }
    .public-header { width: min(var(--hd-public-container), calc(100% - 28px)); gap: 15px; }
    .public-nav { display: none; }
    .public-actions { margin-left: auto; }
    .public-hero, .public-trust, .public-section, .public-cta, .public-footer { width: min(var(--hd-public-container), calc(100% - 28px)); }
    .public-hero { min-height: 0; padding: 60px 0 80px; }
    .hero-copy h1 { font-size: clamp(3rem, 13vw, 5.2rem); }
    html[lang="th"] .hero-copy h1 { font-size: clamp(2.6rem, 11vw, 3.65rem); line-height: 1.08; }
    .preview-grid { grid-template-columns: 1fr; }
    .preview-list { display: none; }
    .public-trust { grid-template-columns: 1fr; gap: 18px; padding-bottom: 45px; }
    .public-section, .integration-section { padding-top: 80px; padding-bottom: 80px; }
    .integration-section { padding-left: 14px; padding-right: 14px; }
    .feature-grid, .roadmap-grid { grid-template-columns: 1fr; }
    .feature-grid article { min-height: 245px; }
    .feature-grid h3 { margin-top: 70px; }
}

@media (max-width: 560px) {
    .public-header .brand > span:last-child { display: none; }
    .public-header .brand-mark { width: 40px; height: 40px; }
    .public-header .outline-button { padding: 0 13px; }
    .public-signup { min-height: 38px; padding: 0 12px; font-size: .68rem; }
    .language-switch { width: 35px; height: 35px; }
    .product-preview { border-radius: 20px; }
    .public-cta { border-radius: 23px; }
    .thread-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .thread-actions .small-button { grid-column: 1 / -1; }
    .message-bubble { max-width: 88%; }
}

/* LINE connection onboarding */
.line-settings-heading { align-items: flex-end; }
.processing-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.processing-badges span { min-height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--hd-line); border-radius: 999px; color: var(--hd-muted); background: var(--hd-surface); font-size: .66rem; font-weight: 700; }
.processing-badges i { width: 7px; height: 7px; border-radius: 50%; background: var(--hd-green); box-shadow: 0 0 0 4px var(--hd-green-soft); }
.connection-guide { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 22px; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-lg); background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.connection-guide article { min-height: 138px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 15px; padding: 25px; }
.connection-guide article + article { border-left: 1px solid var(--hd-line); }
.connection-guide article > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font: 800 .62rem/1 "Red Hat Display", sans-serif; }
.connection-guide strong { display: block; margin: 4px 0 7px; color: var(--hd-ink); font-size: .84rem; }
.connection-guide p { margin: 0; color: var(--hd-muted); font-size: .69rem; line-height: 1.75; }
.line-settings-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .72fr); align-items: start; gap: 22px; }
.connection-list-panel, .connection-create-panel { border: 1px solid var(--hd-line); border-radius: var(--hd-radius-lg); background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.connection-list-panel { padding: 26px; }
.panel-heading h2, .connection-create-panel h2 { margin: 7px 0 0; color: var(--hd-ink); font-size: 1.35rem; }
.connection-list { display: grid; gap: 16px; margin-top: 22px; }
.connection-card { overflow: hidden; border: 1px solid var(--hd-line); border-radius: 18px; background: var(--hd-bg); }
.connection-card > header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--hd-line); background: var(--hd-surface); }
.connection-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.connection-identity > span { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: #fff; background: #06c755; font: 900 .6rem/1 "Red Hat Display", sans-serif; }
.connection-identity > img { width: 44px; height: 44px; display: block; flex: 0 0 auto; border-radius: 13px; object-fit: cover; }
.connection-identity strong, .connection-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection-identity strong { color: var(--hd-ink); font-size: .85rem; }
.connection-identity small { margin-top: 4px; color: var(--hd-muted); font-size: .64rem; }
.connection-state { min-height: 29px; display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; padding: 0 10px; border-radius: 999px; font-size: .6rem; font-weight: 800; }
.connection-state i { width: 7px; height: 7px; border-radius: 50%; }
.connection-state.live { color: var(--hd-green); background: var(--hd-green-soft); }
.connection-state.live i { background: var(--hd-green); }
.connection-state.waiting { color: var(--hd-orange-dark); background: var(--hd-orange-soft); }
.connection-state.waiting i { background: var(--hd-orange); }
.connection-state.error { color: #b42318; background: #fee4e2; }
.connection-state.error i { background: #d92d20; }
.connection-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-bottom: 1px solid var(--hd-line); background: var(--hd-line); }
.connection-metrics > span { min-width: 0; padding: 14px 18px; background: var(--hd-surface); }
.connection-metrics small, .connection-metrics strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection-metrics small { color: var(--hd-muted-2); font-size: .57rem; font-weight: 700; }
.connection-metrics strong { margin-top: 5px; color: var(--hd-charcoal); font-size: .68rem; }
.connection-error { margin: 15px 18px 0; padding: 11px 13px; border-radius: 10px; color: #8a1c13; background: #fee4e2; font-size: .65rem; line-height: 1.6; }
.webhook-block { margin: 16px 18px; padding: 16px; border: 1px solid var(--hd-line); border-radius: 14px; background: var(--hd-surface); }
.webhook-block.recommended { border-color: #edc8a6; box-shadow: inset 3px 0 0 var(--hd-orange); }
.webhook-block > div:first-child { margin-bottom: 11px; }
.webhook-block strong, .webhook-block small { display: block; }
.webhook-block strong { color: var(--hd-ink); font-size: .75rem; }
.webhook-block small { margin-top: 4px; color: var(--hd-muted); font-size: .61rem; line-height: 1.55; }
.member-portal-editor { margin: 16px 18px; border: 1px solid #edc8a6; border-radius: 14px; background: var(--hd-surface); }
.member-portal-editor > summary { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 16px; cursor: pointer; list-style: none; }
.member-portal-editor > summary::-webkit-details-marker { display: none; }
.member-portal-editor > summary > span strong, .member-portal-editor > summary > span small { display: block; }
.member-portal-editor > summary > span strong { color: var(--hd-ink); font-size: .75rem; }
.member-portal-editor > summary > span small { margin-top: 4px; color: var(--hd-muted); font-size: .61rem; }
.member-portal-editor > summary > em { font-style: normal; }
.member-portal-body { padding: 0 16px 16px; border-top: 1px solid var(--hd-line); }
.member-portal-guide { margin: 15px 0; padding: 14px 15px; border-radius: 11px; background: var(--hd-orange-soft); }
.member-portal-guide strong { color: var(--hd-orange-dark); font-size: .69rem; }
.member-portal-guide ol { margin: 8px 0 0; padding-left: 18px; color: var(--hd-muted); font-size: .61rem; line-height: 1.7; }
.member-url-grid { display: grid; gap: 11px; margin-top: 14px; }
.member-url-grid > div > strong, .member-url-grid > div > small { display: block; }
.member-url-grid > div > strong { font-size: .66rem; }
.member-url-grid > div > small { margin: 3px 0 7px; color: var(--hd-muted); font-size: .57rem; }
.member-portal-actions { display: flex; align-items: center; gap: 13px; margin-top: 15px; }
.notification-health { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)) auto; align-items: center; gap: 9px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--hd-line); }
.notification-health > span { padding: 10px; border-radius: 10px; background: var(--hd-bg); }
.notification-health small, .notification-health strong { display: block; }
.notification-health small { color: var(--hd-muted); font-size: .53rem; }
.notification-health strong { margin-top: 3px; font-size: .67rem; }
.copy-field { display: flex; gap: 7px; }
.copy-field + .copy-field { margin-top: 8px; }
.copy-field input { width: 100%; min-width: 0; min-height: 39px; padding: 0 11px; border: 1px solid var(--hd-line-strong); border-radius: 9px; color: var(--hd-charcoal); background: var(--hd-bg); font: 500 .62rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }
.copy-field button { min-width: max-content; padding: 0 12px; border: 1px solid var(--hd-line-strong); border-radius: 9px; color: var(--hd-charcoal); background: var(--hd-surface); font-size: .6rem; font-weight: 800; cursor: pointer; }
.copy-field button:hover { border-color: var(--hd-orange); color: var(--hd-orange-dark); }
.connection-editor { margin: 0 18px 16px; border-top: 1px solid var(--hd-line); }
.connection-editor summary { padding: 15px 2px 8px; color: var(--hd-orange-dark); font-size: .65rem; font-weight: 800; cursor: pointer; }
.connection-editor form { padding-top: 8px; }
.connection-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.connection-form-grid label, .connection-create-panel label { display: block; color: var(--hd-charcoal); font-size: .65rem; font-weight: 700; }
.connection-form-grid label > span, .connection-create-panel label > span { display: block; margin-bottom: 6px; }
.connection-form-grid input, .connection-form-grid select, .connection-create-panel input, .connection-create-panel select, .connection-create-panel textarea { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid var(--hd-line-strong); border-radius: 10px; outline: none; color: var(--hd-ink); background: var(--hd-surface); font: inherit; font-size: .68rem; }
.connection-create-panel textarea { min-height: 112px; padding-top: 10px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.connection-form-grid input:focus, .connection-form-grid select:focus, .connection-create-panel input:focus, .connection-create-panel select:focus, .connection-create-panel textarea:focus { border-color: var(--hd-orange); box-shadow: 0 0 0 4px rgba(218, 133, 60, .1); }
.connection-form-actions { display: flex; justify-content: flex-end; margin-top: 13px; }
.connection-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--hd-line); background: var(--hd-surface); }
.outline-action, .text-action { border: 0; color: var(--hd-orange-dark); background: none; font-size: .62rem; font-weight: 800; cursor: pointer; }
.outline-action { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid #edc8a6; border-radius: 999px; background: var(--hd-orange-soft); }
.text-action.danger { color: #b42318; }
.connection-actions > a { margin-left: auto; }
.connection-actions > a.automation-link { margin-left: 0; }
.connection-create-panel { position: sticky; top: 96px; padding: 25px; }
.connection-create-panel > p { margin: 11px 0 20px; color: var(--hd-muted); font-size: .7rem; line-height: 1.7; }
.connection-create-panel form { display: grid; gap: 14px; }
.primary-button.full { width: 100%; }
.credential-help { margin-top: 21px; padding-top: 18px; border-top: 1px solid var(--hd-line); }
.credential-help strong { color: var(--hd-ink); font-size: .7rem; }
.credential-help p { margin: 7px 0 0; color: var(--hd-muted); font-size: .63rem; line-height: 1.7; }
.line-console-link { min-height: 35px; display: inline-flex; align-items: center; margin-top: 12px; padding: 0 13px; border: 1px solid #b9dfcf; border-radius: 999px; color: #117843; background: #e8f7ef; font-size: .62rem; font-weight: 800; }
[data-setup-mode-field][hidden] { display: none !important; }
.connections-empty { padding: 68px 25px; text-align: center; }
.connections-empty > span { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 50%; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: 1.2rem; }
.connections-empty strong { display: block; color: var(--hd-ink); }
.connections-empty p { max-width: 440px; margin: 8px auto 0; color: var(--hd-muted); font-size: .7rem; line-height: 1.7; }

@media (max-width: 1180px) {
    .line-settings-grid { grid-template-columns: 1fr; }
    .connection-create-panel { position: static; }
}

@media (max-width: 860px) {
    .line-settings-heading { align-items: flex-start; }
    .processing-badges { justify-content: flex-start; }
    .connection-guide { grid-template-columns: 1fr; }
    .connection-guide article + article { border-top: 1px solid var(--hd-line); border-left: 0; }
    .connection-metrics { grid-template-columns: 1fr; }
    .connection-form-grid { grid-template-columns: 1fr; }
    .notification-health { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
    .connection-list-panel, .connection-create-panel { padding: 17px; border-radius: 18px; }
    .connection-card > header { align-items: flex-start; flex-direction: column; }
    .webhook-block, .connection-editor, .member-portal-editor { margin-left: 12px; margin-right: 12px; }
    .copy-field { align-items: stretch; flex-wrap: wrap; }
    .copy-field input { flex-basis: 100%; }
    .copy-field button { min-height: 36px; flex: 1; }
    .connection-actions > a { width: 100%; margin: 4px 0 0; }
}

/* Customer 360 */
.customer-heading { align-items: flex-end; }
.customer-summary { display: grid; grid-template-columns: repeat(3, minmax(92px, 1fr)); gap: 8px; }
.customer-summary > span { min-width: 92px; padding: 12px 14px; border: 1px solid var(--hd-line); border-radius: 13px; background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.customer-summary small, .customer-summary strong { display: block; }
.customer-summary small { color: var(--hd-muted-2); font-size: .57rem; font-weight: 800; }
.customer-summary strong { margin-top: 4px; color: var(--hd-ink); font-size: 1.05rem; }
.customer-workspace { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(400px, .72fr); align-items: start; gap: 18px; }
.customer-list-panel, .customer-detail-panel { min-width: 0; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-lg); background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.customer-list-panel { overflow: hidden; }
.customer-filters { display: grid; grid-template-columns: minmax(220px, 1fr) 145px 165px auto; gap: 9px; padding: 18px; border-bottom: 1px solid var(--hd-line); }
.customer-filters input, .customer-filters select { min-width: 0; min-height: 42px; padding: 0 11px; border: 1px solid var(--hd-line-strong); border-radius: 10px; outline: none; color: var(--hd-ink); background: var(--hd-bg); font-size: .67rem; }
.customer-filters button, .customer-profile-form button, .tag-create-form button, .note-create-form button { min-height: 42px; padding: 0 15px; border: 0; border-radius: 10px; color: #fff; background: var(--hd-orange); font-size: .65rem; font-weight: 800; cursor: pointer; }
.customer-table-head, .customer-row { display: grid; grid-template-columns: minmax(205px, 1.2fr) minmax(145px, .8fr) minmax(125px, .65fr) 82px; gap: 13px; align-items: center; }
.customer-table-head { padding: 10px 18px; color: var(--hd-muted-2); background: var(--hd-surface-soft); font-size: .55rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.customer-row { min-height: 82px; padding: 13px 18px; border-top: 1px solid var(--hd-line); transition: background .2s ease, box-shadow .2s ease; }
.customer-row:first-child { border-top: 0; }
.customer-row:hover { background: #fdfaf7; }
.customer-row.active { background: var(--hd-orange-soft); box-shadow: inset 3px 0 0 var(--hd-orange); }
.customer-person { min-width: 0; display: flex; align-items: center; gap: 11px; }
.customer-person > img, .customer-person > i { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; object-fit: cover; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .75rem; font-style: normal; font-weight: 800; }
.customer-person span, .customer-source, .customer-activity, .customer-points { min-width: 0; }
.customer-person strong, .customer-person small, .customer-source strong, .customer-source small, .customer-activity strong, .customer-activity small, .customer-points strong, .customer-points small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-person strong, .customer-source strong, .customer-activity strong, .customer-points strong { color: var(--hd-charcoal); font-size: .68rem; }
.customer-person small, .customer-source small, .customer-activity small, .customer-points small { margin-top: 3px; color: var(--hd-muted); font-size: .56rem; }
.customer-source b { display: inline-flex; margin-right: 3px; padding: 2px 6px; border-radius: 999px; font-size: .5rem; }
.customer-points { text-align: right; }
.simple-pagination { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-top: 1px solid var(--hd-line); }
.simple-pagination a { color: var(--hd-orange-dark); font-size: .62rem; font-weight: 800; }
.simple-pagination small { color: var(--hd-muted); font-size: .59rem; }
.customer-empty { padding: 80px 25px; text-align: center; }
.customer-empty > span, .customer-detail-empty > span { width: 56px; height: 56px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: 1.2rem; }
.customer-empty strong { display: block; color: var(--hd-ink); }
.customer-empty p { margin: 6px 0 0; font-size: .68rem; }
.customer-detail-panel { position: sticky; top: 96px; overflow: hidden; max-height: calc(100vh - 116px); overflow-y: auto; }
.customer-profile-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 13px; align-items: center; padding: 20px; border-bottom: 1px solid var(--hd-line); }
.customer-profile-header > img, .customer-profile-header > span { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; object-fit: cover; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: 1.05rem; font-weight: 800; }
.customer-profile-header h2 { margin-top: 4px; overflow: hidden; font-size: 1.05rem; text-overflow: ellipsis; white-space: nowrap; }
.customer-profile-header p { margin: 3px 0 0; font-size: .61rem; }
.customer-profile-header > a { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--hd-muted); background: var(--hd-surface-soft); font-size: 1rem; }
.customer-profile-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-bottom: 1px solid var(--hd-line); background: var(--hd-line); }
.customer-profile-metrics > span { padding: 13px 14px; background: var(--hd-bg); }
.customer-profile-metrics small, .customer-profile-metrics strong { display: block; }
.customer-profile-metrics small { color: var(--hd-muted-2); font-size: .54rem; }
.customer-profile-metrics strong { margin-top: 4px; color: var(--hd-charcoal); font-size: .69rem; }
.customer-detail-section { padding: 18px 20px; border-bottom: 1px solid var(--hd-line); }
.customer-detail-section:last-child { border-bottom: 0; }
.customer-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.customer-section-heading h3 { font-size: .82rem; }
.customer-section-heading small, .customer-section-heading a { color: var(--hd-muted); font-size: .56rem; }
.customer-section-heading a { color: var(--hd-orange-dark); font-weight: 800; }
.contact-status { padding: 4px 8px; border-radius: 999px; font-size: .54rem; font-weight: 800; }
.contact-status.active { color: var(--hd-green); background: var(--hd-green-soft); }
.contact-status.paused { color: var(--hd-orange-dark); background: var(--hd-orange-soft); }
.contact-status.blocked { color: var(--hd-red); background: var(--hd-red-soft); }
.customer-profile-form { display: grid; grid-template-columns: 1fr 135px auto; gap: 8px; align-items: end; }
.customer-profile-form label { color: var(--hd-muted); font-size: .57rem; font-weight: 700; }
.customer-profile-form label span { display: block; margin-bottom: 5px; }
.customer-profile-form input, .customer-profile-form select, .tag-create-form input, .tag-create-form select, .note-create-form textarea { width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--hd-line-strong); border-radius: 9px; outline: none; color: var(--hd-ink); background: var(--hd-bg); font: inherit; font-size: .63rem; }
.customer-identities { display: grid; gap: 7px; margin: 14px 0 0; }
.customer-identities > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px; }
.customer-identities dt { color: var(--hd-muted); font-size: .56rem; }
.customer-identities dd { margin: 0; overflow-wrap: anywhere; color: var(--hd-charcoal); font: 500 .56rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.selected-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.selected-tags > span { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 999px; font-size: .58rem; font-weight: 800; }
.tag-orange { color: #b96525; background: #f7e9dc; }
.tag-green { color: #247a52; background: #e8f3ed; }
.tag-purple { color: #7654a6; background: #f0eafb; }
.tag-red { color: #b0443e; background: #faecea; }
.tag-slate { color: #667380; background: #eef0f2; }
.selected-tags form { display: inline; }
.selected-tags button { padding: 0; border: 0; color: currentColor; background: none; cursor: pointer; }
.selected-tags > small, .customer-notes > small, .customer-timeline > small, .customer-ledger > small { color: var(--hd-muted); font-size: .59rem; }
.tag-create-form { display: grid; grid-template-columns: 1fr 90px auto; gap: 7px; margin-top: 11px; }
.note-create-form { display: grid; gap: 7px; }
.note-create-form textarea { min-height: 75px; padding-top: 9px; resize: vertical; }
.note-create-form button { justify-self: end; }
.customer-notes, .customer-timeline, .customer-ledger { display: grid; gap: 8px; margin-top: 12px; }
.customer-notes article { padding: 11px; border: 1px solid var(--hd-line); border-radius: 10px; background: var(--hd-bg); }
.customer-notes p, .customer-timeline p { margin: 0; color: var(--hd-charcoal); font-size: .62rem; line-height: 1.6; white-space: pre-wrap; }
.customer-notes small, .customer-timeline small, .customer-ledger small { display: block; margin-top: 5px; color: var(--hd-muted); font-size: .53rem; }
.customer-timeline article { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; }
.customer-timeline i { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--hd-orange); box-shadow: 0 0 0 4px var(--hd-orange-soft); }
.customer-timeline article.inbound i { background: var(--hd-green); box-shadow: 0 0 0 4px var(--hd-green-soft); }
.customer-ledger article { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hd-line); }
.customer-ledger article:last-child { border-bottom: 0; }
.customer-ledger strong { color: var(--hd-charcoal); font-size: .61rem; }
.customer-ledger b { font-size: .68rem; }
.customer-ledger b.earn { color: var(--hd-green); }
.customer-ledger b.redeem { color: var(--hd-red); }
.customer-detail-empty { min-height: 480px; display: grid; align-content: center; justify-items: center; padding: 35px; text-align: center; }
.customer-detail-empty h2 { font-size: 1rem; }
.customer-detail-empty p { max-width: 300px; margin: 7px 0 0; font-size: .66rem; }

@media (max-width: 1260px) {
    .customer-workspace { grid-template-columns: 1fr; }
    .customer-detail-panel { position: static; max-height: none; }
}

@media (max-width: 860px) {
    .customer-heading { align-items: flex-start; flex-direction: column; }
    .customer-filters { grid-template-columns: 1fr 1fr; }
    .customer-filters input { grid-column: 1 / -1; }
    .customer-table-head { display: none; }
    .customer-row { grid-template-columns: 1fr auto; }
    .customer-source, .customer-activity { grid-column: 1 / 2; margin-left: 51px; }
    .customer-points { grid-column: 2; grid-row: 1; }
}

@media (max-width: 620px) {
    .customer-summary { width: 100%; }
    .customer-summary > span { min-width: 0; padding: 10px; }
    .customer-list-panel, .customer-detail-panel { border-radius: 18px; }
    .customer-filters { grid-template-columns: 1fr; }
    .customer-filters input { grid-column: auto; }
    .customer-profile-form, .tag-create-form { grid-template-columns: 1fr; }
    .customer-profile-metrics { grid-template-columns: 1fr; }
    .customer-profile-metrics > span { display: flex; align-items: center; justify-content: space-between; }
    .customer-profile-metrics strong { margin-top: 0; }
}

/* LINE database-backed event automation */
.automation-heading { align-items: flex-end; }
.automation-status { min-width: 205px; display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--hd-line); border-radius: 15px; background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.automation-status > i { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; }
.automation-status strong, .automation-status small { display: block; }
.automation-status strong { color: var(--hd-charcoal); font-size: .7rem; }
.automation-status small { margin-top: 3px; color: var(--hd-muted); font-size: .6rem; }
.automation-status.live > i { background: var(--hd-green); box-shadow: 0 0 0 5px var(--hd-green-soft); }
.automation-status.off > i { background: var(--hd-muted-2); box-shadow: 0 0 0 5px var(--hd-surface-soft); }
.automation-channel-tabs { display: flex; gap: 9px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: thin; }
.automation-channel-tabs a { min-width: 165px; display: block; padding: 11px 14px; border: 1px solid var(--hd-line); border-radius: 13px; background: var(--hd-surface); }
.automation-channel-tabs a.active { border-color: #e7b98e; background: var(--hd-orange-soft); box-shadow: inset 0 -2px 0 var(--hd-orange); }
.automation-channel-tabs span, .automation-channel-tabs small { display: block; white-space: nowrap; }
.automation-channel-tabs span { color: var(--hd-charcoal); font-size: .7rem; font-weight: 800; }
.automation-channel-tabs small { margin-top: 3px; color: var(--hd-muted); font-size: .57rem; }
.automation-overview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.automation-overview-grid article { min-width: 0; padding: 18px; border: 1px solid var(--hd-line); border-radius: 15px; background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.automation-overview-grid span, .automation-overview-grid strong, .automation-overview-grid small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.automation-overview-grid span { color: var(--hd-muted-2); font: 800 .55rem/1.2 "Red Hat Display", sans-serif; letter-spacing: .11em; }
.automation-overview-grid strong { margin-top: 9px; color: var(--hd-ink); font-size: .86rem; }
.automation-overview-grid small { margin-top: 4px; color: var(--hd-muted); font-size: .61rem; }
.automation-error { display: flex; gap: 12px; margin: 0 0 18px; }
.automation-editor-switch { display: inline-flex; gap: 4px; margin-bottom: 18px; padding: 4px; border: 1px solid var(--hd-line); border-radius: 13px; background: var(--hd-surface-soft); }
.automation-editor-switch a { min-height: 38px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 10px; color: var(--hd-muted); font-size: .67rem; font-weight: 800; }
.automation-editor-switch a.active { color: var(--hd-orange-dark); background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.automation-form { display: grid; gap: 18px; }
.automation-section { padding: 24px; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-lg); background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.automation-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.automation-section-heading h2 { margin-top: 6px; font-size: 1.18rem; }
.automation-section-heading > p { margin: 0; font-size: .64rem; }
.automation-form-grid { display: grid; gap: 15px; }
.automation-form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.automation-form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.automation-form-grid label { min-width: 0; display: block; color: var(--hd-charcoal); font-size: .65rem; font-weight: 700; }
.automation-form-grid label.wide { grid-column: 1 / -1; }
.automation-form-grid label > span, .automation-ai-panel label > span { display: block; margin-bottom: 6px; }
.automation-form-grid input:not([type="checkbox"]), .automation-form-grid select, .automation-form-grid textarea, .code-editor { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid var(--hd-line-strong); border-radius: 10px; outline: none; color: var(--hd-ink); background: var(--hd-bg); font: 500 .68rem/1.65 var(--hd-font); resize: vertical; }
.automation-form-grid input:not([type="checkbox"]), .automation-form-grid select { padding-top: 0; padding-bottom: 0; }
.automation-form-grid input:focus, .automation-form-grid select:focus, .automation-form-grid textarea:focus, .code-editor:focus { border-color: var(--hd-orange); box-shadow: 0 0 0 4px rgba(218, 133, 60, .1); }
.automation-form-grid label > small { display: block; margin-top: 5px; color: var(--hd-muted); font-size: .57rem; font-weight: 500; }
.toggle-field { min-height: 68px; display: flex !important; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 14px; border: 1px solid var(--hd-line); border-radius: 11px; background: var(--hd-bg); }
.toggle-field > span { margin: 0 !important; }
.toggle-field input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.toggle-field b { position: relative; width: 39px; height: 22px; flex: 0 0 auto; border-radius: 999px; background: var(--hd-line-strong); transition: background .2s ease; }
.toggle-field b::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(41,41,41,.2); transition: transform .2s ease; }
.toggle-field input:checked + b { background: var(--hd-orange); }
.toggle-field input:checked + b::after { transform: translateX(17px); }
.automation-help { margin: -5px 0 16px; color: var(--hd-muted); font-size: .64rem; }
.automation-help code { padding: 2px 5px; border-radius: 5px; color: var(--hd-orange-dark); background: var(--hd-orange-soft); }
.automation-rule-list { display: grid; gap: 10px; }
.automation-rule-card { overflow: hidden; border: 1px solid var(--hd-line); border-radius: 14px; background: var(--hd-bg); }
.automation-rule-card[open] { border-color: #e7c6a8; background: var(--hd-surface); }
.automation-rule-card summary { display: flex; align-items: center; gap: 13px; padding: 14px 16px; cursor: pointer; list-style-position: inside; }
.automation-rule-card summary span { color: var(--hd-ink); font-size: .72rem; font-weight: 800; }
.automation-rule-card summary small { min-width: 0; overflow: hidden; color: var(--hd-muted); font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.automation-rule-body { padding: 18px; border-top: 1px solid var(--hd-line); }
.automation-rule-body > .text-action { margin-top: 14px; }
.product-list { margin-top: 16px; }
.automation-publish-bar { position: sticky; bottom: 14px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 20px; padding: 14px 16px; border: 1px solid #e7c6a8; border-radius: 14px; background: rgba(255, 255, 255, .95); box-shadow: 0 12px 32px rgba(41,41,41,.12); backdrop-filter: blur(10px); }
.automation-publish-bar strong, .automation-publish-bar small { display: block; }
.automation-publish-bar strong { color: var(--hd-ink); font-size: .7rem; }
.automation-publish-bar small { margin-top: 3px; color: var(--hd-muted); font-size: .59rem; }
.automation-advanced-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .6fr); align-items: start; gap: 18px; }
.automation-json-panel > p, .automation-ai-panel > p { margin: -5px 0 15px; font-size: .66rem; }
.code-editor { min-height: 620px; border-radius: 13px; color: #43382f; background: #f7f4ef; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .63rem; line-height: 1.75; tab-size: 2; }
.code-editor.compact { min-height: 360px; margin-bottom: 12px; }
.automation-ai-panel { position: sticky; top: 96px; }
.automation-ai-panel h2 { margin: 7px 0 12px; font-size: 1.18rem; }
.outline-action.full { width: 100%; }
.empty-state-panel { padding: 70px 30px; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-lg); background: var(--hd-surface); text-align: center; box-shadow: var(--hd-shadow-soft); }
.empty-state-panel > span { width: 60px; height: 60px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: 1.3rem; }
.empty-state-panel h2 { font-size: 1.25rem; }
.empty-state-panel p { margin: 8px auto 19px; font-size: .7rem; }

@media (max-width: 1120px) {
    .automation-advanced-grid { grid-template-columns: 1fr; }
    .automation-ai-panel { position: static; }
}

@media (max-width: 860px) {
    .automation-heading { align-items: flex-start; }
    .automation-overview-grid { grid-template-columns: 1fr; }
    .automation-form-grid.two, .automation-form-grid.three { grid-template-columns: 1fr; }
    .automation-section-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 620px) {
    .automation-section { padding: 17px; border-radius: 18px; }
    .automation-status { width: 100%; }
    .automation-editor-switch { width: 100%; }
    .automation-editor-switch a { flex: 1; justify-content: center; padding: 0 8px; }
    .automation-rule-card summary { align-items: flex-start; flex-direction: column; }
    .automation-publish-bar { position: static; align-items: stretch; flex-direction: column; }
    .automation-publish-bar .primary-button { width: 100%; }
    .code-editor { min-height: 470px; }
}

/* Phase 1C · Omnichannel Point Engine */
.point-heading { align-items: center; }
.point-engine-badge { min-height: 39px; display: inline-flex; align-items: center; gap: 9px; padding: 0 14px; border: 1px solid #b9dfcf; border-radius: 999px; color: var(--hd-green); background: var(--hd-green-soft); font-size: .66rem; font-weight: 800; }
.point-engine-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--hd-green); box-shadow: 0 0 0 4px rgba(36,122,82,.12); }
.point-stats { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.point-stats article { min-height: 120px; padding: 18px; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-md); background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.point-stats span, .point-stats strong, .point-stats small { display: block; }
.point-stats span { min-height: 35px; color: var(--hd-muted); font-size: .65rem; font-weight: 700; }
.point-stats strong { margin: 7px 0 4px; color: var(--hd-ink); font-size: 1.65rem; line-height: 1; }
.point-stats small { color: var(--hd-muted-2); font-size: .56rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.point-stats article.warning strong { color: var(--hd-orange-dark); }
.point-tabs { display: inline-flex; gap: 4px; margin-bottom: 18px; padding: 4px; border: 1px solid var(--hd-line); border-radius: 14px; background: var(--hd-surface-soft); }
.point-tabs a { min-height: 39px; display: inline-flex; align-items: center; padding: 0 17px; border-radius: 10px; color: var(--hd-muted); font-size: .67rem; font-weight: 800; }
.point-tabs a.active { color: var(--hd-orange-dark); background: var(--hd-surface); box-shadow: var(--hd-shadow-soft); }
.point-ledger-layout, .point-api-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; align-items: start; }
.point-ledger-panel { padding: 0; overflow: hidden; }
.point-ledger-panel > .panel-heading { padding: 23px 23px 0; }
.point-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 0 23px 16px; }
.point-search input { min-height: 41px; padding: 0 12px; border: 1px solid var(--hd-line-strong); border-radius: 10px; outline: none; background: var(--hd-bg); font-size: .68rem; }
.point-search button { min-width: 80px; border: 0; border-radius: 10px; color: #fff; background: var(--hd-charcoal); font-size: .65rem; font-weight: 800; }
.point-ledger-panel .table-wrap { padding: 0 12px 10px; }
.table-subcopy { display: block; margin-top: 3px; color: var(--hd-muted-2); font-size: .55rem; }
.point-type { display: inline-flex; padding: 4px 8px; border-radius: 999px; color: var(--hd-muted); background: var(--hd-surface-soft); font-size: .52rem; font-weight: 900; letter-spacing: .05em; }
.point-type.type-earn { color: var(--hd-green); background: var(--hd-green-soft); }
.point-type.type-redeem { color: var(--hd-orange-dark); background: var(--hd-orange-soft); }
.point-type.type-reversal, .point-type.type-expire { color: var(--hd-red); background: var(--hd-red-soft); }
.point-type.type-adjustment { color: var(--hd-purple); background: color-mix(in srgb, var(--hd-purple) 12%, transparent); }
.point-panel-help { margin: -4px 0 16px; color: var(--hd-muted); font-size: .76rem; line-height: 1.65; }
.point-card-actions { display: flex; align-items: center; gap: 12px; margin: 14px 0 2px; }
.point-card-actions form { margin: 0; }
.point-config-card label small { display: block; margin-top: 7px; color: var(--hd-muted); font-size: .66rem; line-height: 1.5; }
.point-amount { font-weight: 900; }
.point-amount.positive { color: var(--hd-green); }
.point-amount.negative { color: var(--hd-red); }
.point-reverse-form { margin: 0; }
.point-sidebar, .point-api-main { display: grid; gap: 16px; }
.point-action-panel, .point-create-panel, .point-settings-panel { padding: 22px; }
.point-action-panel .crm-form-grid, .point-create-panel .crm-form-grid, .point-settings-panel .crm-form-grid { grid-template-columns: 1fr 1fr; }
.crm-form-grid input[type="url"] { width: 100%; min-height: 43px; padding: 0 12px; border: 1px solid var(--hd-line-strong); border-radius: 10px; outline: none; color: var(--hd-ink); background: var(--hd-surface); font: inherit; font-size: .68rem; }
.crm-form-grid label > small { display: block; margin-top: 5px; color: var(--hd-muted); font-size: .55rem; font-weight: 500; }
.outline-button { min-height: 43px; border: 1px solid var(--hd-line-strong); border-radius: 10px; color: var(--hd-charcoal); background: var(--hd-surface); font-size: .67rem; font-weight: 800; cursor: pointer; }
.point-form-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--hd-muted-2); font-size: .58rem; font-weight: 800; text-transform: uppercase; }
.point-form-divider::before, .point-form-divider::after { height: 1px; flex: 1; content: ""; background: var(--hd-line); }
.pagination-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 22px 18px; color: var(--hd-muted); font-size: .61rem; }
.pagination-row div { display: flex; gap: 7px; }
.pagination-row a, .pagination-row div span { padding: 5px 9px; border: 1px solid var(--hd-line); border-radius: 8px; background: var(--hd-surface); }
.point-admin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; align-items: start; }
.point-card-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.point-config-card { padding: 20px; }
.point-config-card header h2 { margin: 10px 0 5px; font-size: .94rem; }
.point-config-card header p { margin: 0; font-size: .63rem; }
.point-config-card header code, .point-api-docs code { color: var(--hd-orange-dark); }
.point-config-card details { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--hd-line); }
.point-config-card summary { color: var(--hd-muted); cursor: pointer; font-size: .64rem; font-weight: 800; }
.point-config-card details .crm-form-grid { margin-top: 15px; }
.point-config-card details > form:last-child { margin-top: 11px; }
.point-create-panel { position: sticky; top: 96px; }
.checkbox-line { display: flex !important; align-items: center; gap: 8px; min-height: 36px; color: var(--hd-muted); font-size: .64rem; }
.point-scope-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 13px; border: 1px solid var(--hd-line); border-radius: 11px; }
.point-scope-list legend { padding: 0 5px; color: var(--hd-charcoal); font-size: .64rem; font-weight: 800; }
.point-scope-list label { color: var(--hd-muted); font-size: .59rem; }
.point-api-main { min-width: 0; }
.one-time-credential { padding: 22px; border: 1px solid #edc8a6; border-radius: var(--hd-radius-lg); background: var(--hd-orange-soft); box-shadow: var(--hd-shadow-soft); }
.one-time-credential h2 { margin: 7px 0 13px; font-size: 1rem; }
.one-time-credential h1 { margin: 8px 0 7px; font-size: 1.7rem; }
.one-time-credential p { margin: 10px 0 0; font-size: .63rem; }
.secret-copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.secret-copy-row code { min-width: 0; overflow: hidden; padding: 10px 12px; border: 1px solid #edc8a6; border-radius: 10px; color: var(--hd-charcoal); background: var(--hd-surface); font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.api-client-list { display: grid; gap: 9px; }
.api-client-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--hd-line); border-radius: 12px; background: var(--hd-bg); }
.api-client-card.revoked { opacity: .58; }
.api-client-card strong, .api-client-card code, .api-client-card small { display: block; }
.api-client-card strong { font-size: .72rem; }
.api-client-card code { margin: 5px 0; color: var(--hd-orange-dark); font-size: .58rem; }
.api-client-card small { color: var(--hd-muted); font-size: .55rem; }
.point-api-docs > p { margin: -6px 0 15px; font-size: .65rem; }
.endpoint-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.endpoint-list code { padding: 10px; border: 1px solid var(--hd-line); border-radius: 9px; background: var(--hd-bg); font-size: .59rem; }
.api-security-note { margin-top: 16px; padding: 15px; border-left: 3px solid var(--hd-orange); border-radius: 0 10px 10px 0; background: var(--hd-orange-soft); }
.api-security-note strong { font-size: .68rem; }
.api-security-note p { margin: 5px 0 0; font-size: .61rem; }
.credential-result-wrap { min-height: calc(100vh - 155px); display: grid; place-items: center; }
.credential-result-card { width: min(760px, 100%); padding: 34px; }
.credential-result-card > p { margin: 0 0 20px; }
.credential-result-card .secret-copy-row code { min-height: 54px; display: flex; align-items: center; white-space: normal; word-break: break-all; }
.credential-back { width: fit-content; display: inline-flex; align-items: center; justify-content: center; margin-top: 20px; padding: 0 18px; }

@media (max-width: 1240px) {
    .point-ledger-layout, .point-api-layout, .point-admin-layout { grid-template-columns: minmax(0, 1fr) 340px; }
    .point-stats { grid-template-columns: repeat(3, 1fr); }
    .point-card-list { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
    .point-ledger-layout, .point-api-layout, .point-admin-layout { grid-template-columns: 1fr; }
    .point-create-panel { position: static; }
}
@media (max-width: 680px) {
    .point-stats { grid-template-columns: 1fr 1fr; }
    .point-tabs { width: 100%; overflow-x: auto; }
    .point-tabs a { flex: 1 0 auto; justify-content: center; }
    .point-action-panel .crm-form-grid, .point-create-panel .crm-form-grid, .point-settings-panel .crm-form-grid { grid-template-columns: 1fr; }
    .point-action-panel .span-2, .point-create-panel .span-2, .point-settings-panel .span-2 { grid-column: auto; }
    .endpoint-list, .point-scope-list { grid-template-columns: 1fr; }
    .api-client-card { grid-template-columns: 1fr auto; }
    .api-client-card form { grid-column: 1 / -1; }
}

/* Phase 1D · Data Source Hub */
.data-source-heading { align-items: center; }
.data-source-live { min-height: 39px; display: inline-flex; align-items: center; gap: 9px; padding: 0 14px; border: 1px solid #b9dfcf; border-radius: 999px; color: var(--hd-green); background: var(--hd-green-soft); font-size: .64rem; font-weight: 800; white-space: nowrap; }
.data-source-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--hd-green); box-shadow: 0 0 0 4px rgba(36, 122, 82, .12); }
.source-hub-grid { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.source-hub-card { min-width: 0; display: flex; flex-direction: column; min-height: 230px; padding: 24px; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-lg); background: var(--hd-surface); box-shadow: var(--hd-shadow); }
.source-hub-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.source-hub-logo { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: var(--hd-orange); font-size: .58rem; font-weight: 900; }
.source-hub-logo.line { background: #06c755; }
.source-hub-logo.facebook { background: #1877f2; font: 800 1.05rem/1 Arial, sans-serif; text-transform: lowercase; }
.source-hub-logo.website { color: var(--hd-orange-dark); background: var(--hd-orange-soft); }
.source-hub-logo.cdp { background: linear-gradient(135deg, var(--hd-purple), var(--hd-orange)); }
.source-hub-card h2 { margin: 24px 0 9px; font-size: 1.08rem; }
.source-hub-card p { max-width: 620px; flex: 1; margin: 0; color: var(--hd-muted); font-size: .68rem; line-height: 1.68; }
.source-hub-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 17px; }
.source-hub-actions a { min-height: 32px; display: inline-flex; align-items: center; padding: 0 11px; border: 1px solid var(--hd-line-strong); border-radius: 999px; color: var(--hd-charcoal); background: var(--hd-surface); font-size: .56rem; font-weight: 800; }
.source-hub-actions a:hover { color: var(--hd-orange-dark); border-color: var(--hd-orange); background: var(--hd-orange-soft); }
.data-source-stat-grid { grid-template-columns: repeat(4, minmax(140px, 1fr)); }
.data-source-stats-first { margin: 0 0 22px; }
.data-source-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; align-items: start; }
.data-source-main { min-width: 0; display: grid; gap: 16px; }
.data-source-card-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.data-source-card { min-width: 0; padding: 18px; border: 1px solid var(--hd-line); border-radius: var(--hd-radius-md); background: var(--hd-bg); }
.data-source-card.archived { opacity: .58; }
.data-source-card > header, .data-source-card-title, .source-danger-actions { display: flex; align-items: center; }
.data-source-card > header { justify-content: space-between; gap: 12px; }
.data-source-card-title { min-width: 0; gap: 11px; }
.data-source-card-title > div { min-width: 0; }
.data-source-card-title strong, .data-source-card-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-source-card-title strong { color: var(--hd-ink); font-size: .73rem; }
.data-source-card-title small { margin-top: 4px; color: var(--hd-muted); font-size: .55rem; }
.source-logo { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .55rem; font-weight: 900; }
.source-logo.webhook { color: var(--hd-purple); background: color-mix(in srgb, var(--hd-purple) 12%, white); }
.source-logo.cdp { color: #fff; background: linear-gradient(135deg, var(--hd-purple), var(--hd-orange)); }
.source-logo.facebook { color: #fff; background: #1877f2; font-family: Arial, sans-serif; font-size: 1rem; text-transform: lowercase; }
.facebook-connect-box { margin-bottom: 18px; padding: 13px; border: 1px solid #bfd5f4; border-radius: 13px; background: color-mix(in srgb, #1877f2 5%, white); }
.facebook-connect-box > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.facebook-connect-box > summary::-webkit-details-marker { display: none; }
.facebook-connect-box > summary strong, .facebook-connect-box > summary small { display: block; }
.facebook-connect-box > summary strong { color: var(--hd-ink); font-size: .68rem; }
.facebook-connect-box > summary small { margin-top: 3px; color: var(--hd-muted); font-size: .53rem; line-height: 1.4; }
.facebook-connect-box > form { margin-top: 15px; }
.source-create-divider { display: flex; align-items: center; gap: 9px; margin: 18px 0; color: var(--hd-muted-2); font-size: .52rem; font-weight: 800; text-transform: uppercase; }
.source-create-divider::before, .source-create-divider::after { height: 1px; flex: 1; content: ''; background: var(--hd-line); }
.facebook-webhook-config { display: grid; gap: 8px; margin: 13px 0; }
.facebook-webhook-config label { display: grid; gap: 5px; }
.facebook-webhook-config span { color: var(--hd-muted); font-size: .53rem; font-weight: 800; }
.facebook-webhook-config code { overflow-wrap: anywhere; padding: 8px; border: 1px solid var(--hd-line); border-radius: 8px; background: var(--hd-surface); font-size: .51rem; }
.secure-pairing-box { display: grid; gap: 7px; margin-top: 13px; padding: 12px; border: 1px solid color-mix(in srgb, var(--hd-purple) 28%, var(--hd-line)); border-radius: 11px; background: color-mix(in srgb, var(--hd-purple) 5%, white); }
.secure-pairing-box > strong { font-size: .65rem; }
.secure-pairing-box > p, .secure-pairing-box > small { margin: 0; color: var(--hd-muted); font-size: .53rem; line-height: 1.5; }
.identity-linked-list, .identity-candidate-list { display: grid; gap: 9px; }
.identity-linked-item, .identity-candidate-item { padding: 12px; border: 1px solid var(--hd-line); border-radius: 11px; background: var(--hd-bg); }
.identity-linked-item strong, .identity-linked-item small { display: block; }
.identity-linked-item small { margin-top: 3px; color: var(--hd-muted); font-size: .57rem; }
.identity-candidate-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.identity-candidate-item p { margin: 3px 0 0; color: var(--hd-muted); font-size: .58rem; }
.identity-candidate-actions { display: flex; gap: 7px; }
.identity-candidate-actions form { margin: 0; }
.identity-resolution-section .customer-section-heading small { color: var(--hd-muted-2); font-size: .53rem; }
.linked-profile-list { display: grid; gap: 7px; margin-bottom: 10px; }
.linked-profile-list article { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--hd-line); border-radius: 10px; background: var(--hd-bg); }
.linked-profile-list article > span { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .57rem; font-weight: 900; }
.linked-profile-list strong, .linked-profile-list small { display: block; }
.linked-profile-list strong { font-size: .62rem; }
.linked-profile-list small { margin-top: 2px; color: var(--hd-muted); font-size: .51rem; }
.linked-profile-list b { color: var(--hd-green); font-size: .51rem; }
.identity-candidate-card { display: grid; gap: 10px; padding: 11px; border: 1px solid #edc8a6; border-radius: 11px; background: var(--hd-orange-soft); }
.identity-candidate-card + .identity-candidate-card { margin-top: 8px; }
.identity-candidate-card > div:first-child span, .identity-candidate-card > div:first-child strong, .identity-candidate-card > div:first-child small { display: block; }
.identity-candidate-card > div:first-child span { color: var(--hd-orange-dark); font-size: .51rem; font-weight: 900; text-transform: uppercase; }
.identity-candidate-card > div:first-child strong { margin-top: 4px; color: var(--hd-ink); font-size: .68rem; }
.identity-candidate-card > div:first-child small { margin-top: 3px; color: var(--hd-muted); font-size: .52rem; }
.identity-candidate-actions button { min-height: 31px; padding: 0 9px; border: 0; border-radius: 8px; color: #fff; background: var(--hd-ink); font: inherit; font-size: .52rem; font-weight: 800; cursor: pointer; }
.identity-candidate-actions .text-action { color: var(--hd-red); background: transparent; }
.member-profile-editor { margin-top: 8px; }
.member-profile-editor summary { color: var(--hd-orange-dark); cursor: pointer; font-size: .57rem; font-weight: 800; }
.member-profile-form { min-width: 260px; display: grid; gap: 7px; margin-top: 9px; }
.member-profile-form input { width: 100%; min-height: 35px; padding: 0 9px; border: 1px solid var(--hd-line-strong); border-radius: 8px; font: inherit; font-size: .62rem; }
.member-reset-form { margin-top: 8px; }
.data-source-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 16px 0 12px; }
.data-source-metrics span { min-width: 0; padding: 9px; border: 1px solid var(--hd-line); border-radius: 10px; background: var(--hd-surface); }
.data-source-metrics small, .data-source-metrics strong { display: block; }
.data-source-metrics small { overflow: hidden; color: var(--hd-muted-2); font-size: .48rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.data-source-metrics strong { overflow: hidden; margin-top: 4px; color: var(--hd-ink); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.source-endpoint { overflow: hidden; padding: 10px; border: 1px solid var(--hd-line); border-radius: 9px; background: var(--hd-surface); }
.source-endpoint code { display: block; overflow: hidden; color: var(--hd-muted); font-size: .55rem; text-overflow: ellipsis; white-space: nowrap; }
.source-error { margin: 9px 0 0; padding: 9px; border-radius: 8px; color: var(--hd-red); background: var(--hd-red-soft); font-size: .56rem; line-height: 1.5; }
.data-source-card details { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--hd-line); }
.data-source-card summary { color: var(--hd-muted); cursor: pointer; font-size: .61rem; font-weight: 800; }
.data-source-card details > .crm-form-grid { margin-top: 14px; }
.facebook-automation-settings { min-width: 0; margin: 5px 0 0; padding: 14px; border: 1px solid var(--hd-line); border-radius: 12px; background: var(--hd-surface); }
.facebook-automation-settings legend { padding: 0 7px; color: var(--hd-orange-dark); font-size: .68rem; font-weight: 900; }
.facebook-automation-settings .form-help { margin: 0 0 12px; color: var(--hd-muted); font-size: .58rem; line-height: 1.6; }
.facebook-automation-settings > small { display: block; margin-top: 10px; color: var(--hd-muted); font-size: .55rem; line-height: 1.5; }
.source-danger-actions { justify-content: space-between; gap: 10px; margin-top: 12px; }
.source-danger-actions form { margin: 0; }
.text-action { padding: 0; border: 0; color: var(--hd-orange-dark); background: none; font: inherit; font-size: .58rem; font-weight: 800; cursor: pointer; }
.text-action.danger { color: var(--hd-red); }
.data-source-create-panel { position: sticky; top: 96px; }
.data-source-create-panel > p { margin: -5px 0 18px; color: var(--hd-muted); font-size: .66rem; line-height: 1.6; }
.data-source-config-layout { display: grid; grid-template-columns: minmax(330px, 430px) minmax(0, 1fr); gap: 16px; align-items: start; }
.data-source-config-form { position: sticky; top: 96px; }
.data-source-config-form > h2 { margin: 20px 0 8px; font-size: 1.15rem; }
.data-source-config-form > p { margin: 0 0 20px; color: var(--hd-muted); font-size: .66rem; line-height: 1.6; }
.data-source-config-form .panel-heading { margin-bottom: 0; }
.config-source-card-list { grid-template-columns: 1fr; }
.config-source-card-list .data-source-card { background: var(--hd-surface-soft); }
.data-source-events-panel .table-wrap { overflow-x: auto; }
.data-source-events-panel table { min-width: 900px; }
.error-copy { color: var(--hd-red); }
.empty-state-panel { min-height: 230px; display: grid; place-content: center; justify-items: center; padding: 26px; text-align: center; }
.empty-state-panel > span { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: 1.35rem; }
.empty-state-panel h2 { margin: 14px 0 5px; font-size: .88rem; }
.empty-state-panel p { max-width: 350px; margin: 0; color: var(--hd-muted); font-size: .63rem; line-height: 1.6; }
.source-credential-panel { width: min(840px, 100%); }
.source-credential-panel > label { display: block; margin-top: 16px; }
.source-credential-panel > label > span { display: block; margin-bottom: 7px; color: var(--hd-charcoal); font-size: .64rem; font-weight: 800; }
.source-credential-panel .copy-field code { min-width: 0; flex: 1; overflow: auto; padding: 11px 12px; border: 1px solid var(--hd-line-strong); border-radius: 9px; color: var(--hd-charcoal); background: var(--hd-bg); font-size: .61rem; white-space: nowrap; }
.credential-warning { padding: 16px; border-left: 3px solid var(--hd-orange); border-radius: 0 12px 12px 0; background: var(--hd-orange-soft); }
.credential-warning strong { font-size: .73rem; }
.credential-warning p { margin: 5px 0 0; color: var(--hd-muted); font-size: .62rem; line-height: 1.6; }
.source-contract { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--hd-line); }
.source-contract h2 { margin: 0 0 5px; font-size: .9rem; }
.source-contract h3 { margin: 20px 0 7px; font-size: .72rem; }
.source-contract p { margin: 0 0 12px; color: var(--hd-muted); font-size: .64rem; line-height: 1.6; }
.source-contract pre { max-width: 100%; overflow: auto; padding: 15px; border: 1px solid var(--hd-line); border-radius: 12px; color: var(--hd-charcoal); background: var(--hd-bg); font-size: .59rem; line-height: 1.6; }

.customer-source-identities { display: grid; gap: 9px; }
.customer-source-identities article { padding: 12px; border: 1px solid var(--hd-line); border-radius: 11px; background: var(--hd-bg); }
.customer-source-identities header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.customer-source-identities header strong { font-size: .67rem; }
.customer-source-identities header span { color: var(--hd-orange-dark); font-size: .51rem; font-weight: 800; }
.customer-source-identities dl { display: grid; gap: 6px; margin: 0; }
.customer-source-identities dl div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; }
.customer-source-identities dt { color: var(--hd-muted-2); font-size: .52rem; }
.customer-source-identities dd { min-width: 0; overflow-wrap: anywhere; color: var(--hd-charcoal); font-size: .57rem; }
.identity-verification { margin-left: 4px; color: var(--hd-muted-2); font-size: .48rem; }
.identity-verification.verified { color: var(--hd-green); font-weight: 800; }

@media (max-width: 1260px) {
    .source-hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .data-source-layout { grid-template-columns: minmax(0, 1fr) 340px; }
    .data-source-card-list { grid-template-columns: 1fr; }
    .data-source-config-layout { grid-template-columns: 360px minmax(0, 1fr); }
}
@media (max-width: 980px) {
    .data-source-layout { grid-template-columns: 1fr; }
    .data-source-create-panel { position: static; }
    .data-source-config-layout { grid-template-columns: 1fr; }
    .data-source-config-form { position: static; }
}
@media (max-width: 680px) {
    .data-source-heading { align-items: flex-start; }
    .data-source-live { margin-top: 14px; }
    .data-source-stat-grid { grid-template-columns: 1fr 1fr; }
    .source-hub-grid { grid-template-columns: 1fr; }
    .source-hub-card { min-height: 190px; }
    .data-source-metrics { grid-template-columns: 1fr 1fr; }
    .data-source-card { padding: 14px; }
    .source-danger-actions { align-items: flex-start; flex-direction: column; }
    .source-credential-panel .copy-field code { flex-basis: 100%; }
}

/* v16.6.0 · Platform Super Admin overview */
.platform-role-badge { margin-left: 5px; color: #ffffff; background: var(--hd-charcoal); }
.super-admin-heading { align-items: center; }
.super-admin-heading-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.super-readonly-badge { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border: 1px solid #efd2b8; border-radius: 999px; color: var(--hd-orange-dark); background: var(--hd-orange-soft); font-size: .58rem; font-weight: 900; letter-spacing: .08em; }
.super-readonly-badge::before { width: 7px; height: 7px; content: ""; border-radius: 50%; background: var(--hd-orange); }
.super-admin-overview-grid { grid-template-columns: minmax(0, 2fr) minmax(310px, .75fr); }
.super-admin-workspace-grid { grid-template-columns: minmax(0, 1.65fr) minmax(330px, .75fr); }

.super-trend-chart { height: 260px; display: grid; grid-template-columns: repeat(12, minmax(32px, 1fr)); align-items: end; gap: 9px; padding: 12px 4px 0; }
.super-trend-column { min-width: 0; height: 100%; display: grid; grid-template-rows: 22px minmax(0, 1fr) 24px; align-items: end; justify-items: center; }
.super-trend-column > span { color: var(--hd-charcoal); font-size: .57rem; font-weight: 800; }
.super-trend-column > small { align-self: center; color: var(--hd-muted-2); font-size: .52rem; font-weight: 700; }
.super-trend-track { position: relative; width: min(30px, 72%); height: 100%; overflow: hidden; border-radius: 9px 9px 4px 4px; background: var(--hd-surface-soft); }
.super-trend-track i { position: absolute; right: 0; bottom: 0; left: 0; min-height: 0; border-radius: 9px 9px 4px 4px; background: linear-gradient(180deg, var(--hd-orange), #efb37d); box-shadow: 0 -8px 18px rgba(218, 133, 60, .14); transition: height .3s ease; }

.super-attention-list { display: grid; gap: 8px; }
.super-attention-list > div { min-height: 47px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--hd-line); border-radius: 12px; background: var(--hd-bg); }
.super-attention-list strong { color: var(--hd-charcoal); font-size: .66rem; font-weight: 700; line-height: 1.4; }
.super-attention-list b { min-width: 28px; color: var(--hd-ink); font-size: .84rem; text-align: right; }
.attention-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hd-muted-2); box-shadow: 0 0 0 4px var(--hd-surface-soft); }
.attention-dot.warning { background: var(--hd-orange); box-shadow: 0 0 0 4px var(--hd-orange-soft); }
.attention-dot.danger { background: var(--hd-red); box-shadow: 0 0 0 4px var(--hd-red-soft); }

.super-workspace-table { min-width: 720px; }
.super-workspace-table td:first-child strong, .super-workspace-table td:first-child small { display: block; }
.super-workspace-table td:first-child small { margin: 3px 0 7px; color: var(--hd-muted-2); font-size: .56rem; }
.super-workspace-table td:nth-child(2) strong, .super-workspace-table td:nth-child(2) small { display: inline; }
.super-workspace-table td:nth-child(2) small { margin-left: 3px; color: var(--hd-muted-2); }
.super-status-pill, .super-account-status { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: .53rem; font-weight: 800; }
.super-status-pill.is-active, .super-account-status.status-active { color: var(--hd-green); background: var(--hd-green-soft); }
.super-status-pill.is-inactive, .super-account-status.status-inactive { color: var(--hd-red); background: var(--hd-red-soft); }
.super-account-status.status-idle, .super-account-status.status-never { color: var(--hd-orange-dark); background: var(--hd-orange-soft); }

.super-distribution-panel h3 { margin: 0 0 12px; color: var(--hd-charcoal); font-size: .7rem; }
.super-distribution-panel h3.super-role-heading { margin-top: 25px; padding-top: 21px; border-top: 1px solid var(--hd-line); }
.super-distribution-list { display: grid; gap: 12px; }
.super-distribution-list > div > span { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.super-distribution-list strong { color: var(--hd-muted); font-size: .62rem; font-weight: 700; }
.super-distribution-list b { color: var(--hd-ink); font-size: .64rem; }
.super-distribution-list i { height: 6px; display: block; overflow: hidden; margin-top: 6px; border-radius: 999px; background: var(--hd-surface-soft); }
.super-distribution-list em { height: 100%; display: block; border-radius: inherit; background: var(--hd-orange); }
.super-distribution-list.role-distribution em { background: var(--hd-slate); }

.super-members-panel { overflow: hidden; padding: 0; }
.super-members-heading { align-items: flex-start; margin: 0; padding: 23px 23px 18px; }
.super-members-heading p { margin: 7px 0 0; font-size: .67rem; }
.super-member-filters { display: grid; grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(135px, .8fr)) auto; align-items: end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--hd-line); border-bottom: 1px solid var(--hd-line); background: var(--hd-surface-soft); }
.super-member-filters label > span { display: block; margin: 0 0 6px; color: var(--hd-muted); font-size: .54rem; font-weight: 800; }
.super-member-filters input[type="search"], .super-member-filters select { width: 100%; min-height: 40px; padding: 0 11px; border: 1px solid var(--hd-line-strong); border-radius: 10px; outline: none; color: var(--hd-ink); background: var(--hd-surface); font: inherit; font-size: .64rem; }
.super-member-filters input[type="search"]:focus, .super-member-filters select:focus { border-color: var(--hd-orange); box-shadow: 0 0 0 4px rgba(218, 133, 60, .1); }
.super-filter-actions { min-height: 40px; display: flex; align-items: center; gap: 6px; }
.super-filter-actions button, .super-filter-actions a { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 13px; border-radius: 10px; font-size: .61rem; font-weight: 800; white-space: nowrap; }
.super-filter-actions button { border: 0; color: #ffffff; background: var(--hd-charcoal); cursor: pointer; }
.super-filter-actions a { border: 1px solid var(--hd-line-strong); color: var(--hd-muted); background: var(--hd-surface); }
.super-members-table { min-width: 1050px; }
.super-members-panel > .table-wrap { padding: 0 18px; }
.super-member-cell { min-width: 205px; }
.super-mini-badge { display: inline-flex; margin-top: 5px; padding: 2px 6px; border-radius: 999px; color: #ffffff; background: var(--hd-charcoal); font-size: .46rem; font-weight: 900; letter-spacing: .06em; }
.super-chip-list { min-width: 150px; display: flex; flex-wrap: wrap; gap: 5px; }
.super-workspace-chip { display: inline-flex; padding: 4px 7px; border: 1px solid var(--hd-line); border-radius: 999px; color: var(--hd-charcoal); background: var(--hd-surface-soft); font-size: .54rem; font-weight: 700; }
.super-workspace-chip.is-disabled { opacity: .5; text-decoration: line-through; }
.super-members-panel .pagination-row { border-top: 1px solid var(--hd-line); }

@media (max-width: 1320px) {
    .super-member-filters { grid-template-columns: 1.4fr repeat(2, 1fr); }
    .super-filter-actions { align-self: end; }
}

@media (max-width: 1050px) {
    .super-admin-overview-grid, .super-admin-workspace-grid { grid-template-columns: 1fr; }
    .super-admin-heading { align-items: flex-start; }
    .super-trend-chart { height: 230px; }
}

@media (max-width: 720px) {
    .super-admin-heading-actions { justify-content: flex-start; margin-top: 15px; }
    .super-readonly-badge, .super-admin-heading-actions .date-chip { margin-top: 16px; }
    .super-trend-chart { height: 210px; gap: 4px; overflow-x: auto; }
    .super-trend-column { min-width: 30px; }
    .super-member-filters { grid-template-columns: 1fr; }
    .super-filter-actions { width: 100%; }
    .super-filter-actions button, .super-filter-actions a { flex: 1; }
    .super-members-heading { display: block; }
}

/* HOSTDRIFT_SAFETYPPE_ASSISTANT_CITATIONS */
.assistant-citations{margin-top:10px;padding-top:10px;border-top:1px solid rgba(15,47,63,.12);display:grid;gap:6px}.assistant-citations>small{font-size:10px;letter-spacing:.12em;font-weight:800;color:#55a630}.assistant-citations>a{display:block;font-size:12px;line-height:1.45;color:#2f5f42;text-decoration:none}.assistant-citations>a:hover{text-decoration:underline}.assistant-citations>a span{display:inline-block;margin-right:6px;padding:2px 6px;border-radius:999px;background:#edf8e9;color:#4d922f;font-size:9px;font-weight:800;letter-spacing:.05em}
/* HOSTDRIFT_INBOX_THREAD_ISOLATION_1676 */
.line-thread-badge{display:inline-flex;align-items:center;margin-left:7px;padding:2px 7px;border-radius:999px;font-size:9px;font-style:normal;font-weight:800;letter-spacing:.05em;vertical-align:middle}.line-thread-badge.is-user{background:#f2f2f4;color:#6b6b73}.line-thread-badge.is-group{background:#eaf7ef;color:#237b4b}.message-render-fallback{display:block;margin-top:6px;color:#8b8b93;font-size:10px}
/* HOSTDRIFT_INBOX_CONVERSATION_UX_1677 */
.line-rich-message{width:min(100%,760px)}.line-rich-carousel{display:flex;gap:12px;overflow-x:auto;padding:4px 2px 10px;scroll-snap-type:x proximity}.line-rich-card{flex:0 0 min(340px,85%);scroll-snap-align:start;border:1px solid #e5e5e7;border-radius:20px;background:var(--rich-card-bg,#fff);overflow:hidden;box-shadow:0 8px 24px rgba(0,0,0,.05)}.line-rich-card>img{width:100%;aspect-ratio:16/9;object-fit:cover}.line-rich-card-body{padding:18px}.line-rich-card-body strong{display:block;font-size:16px;line-height:1.35;color:#1d1d1f}.line-rich-card-body p{margin:7px 0 0;color:#6e6e73;line-height:1.45}.line-rich-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.line-rich-actions a,.line-rich-actions span{display:inline-flex;align-items:center;min-height:36px;padding:0 13px;border-radius:999px;background:#f5f5f7;color:#1d1d1f;font-size:12px;font-weight:700;text-decoration:none}.rich-message-label{display:block;margin:0 0 8px;color:#6e6e73;font-size:10px;font-weight:800;letter-spacing:.06em}.assistant-citations{margin-top:12px;padding-top:10px;border-top:1px solid #ececee}.assistant-citations small{display:block;margin-bottom:6px;color:#8e8e93;font-size:9px;font-weight:800;letter-spacing:.08em}.assistant-citations a{display:block;margin-top:5px;color:#2563eb;font-size:11px;text-decoration:none}.message-render-fallback{display:block;margin-top:6px;color:#8e8e93;font-size:9px}
/* HOSTDRIFT_WORKSPACE_UX_1678 */
.inbox-shell{height:var(--hd-inbox-height,calc(100dvh - 210px));min-height:520px;max-height:none}
.conversation-panel,.thread-panel{height:100%;min-height:0}
.conversation-list,.message-stream{min-height:0;overscroll-behavior:contain;scrollbar-gutter:stable}
.thread-panel{overflow:hidden}
.thread-header,.reply-area{flex:0 0 auto}
.message-stream{overflow-y:auto}
.message-bubble.has-rich-message{width:min(82%,780px);max-width:780px;padding:11px 12px}
.message-bubble.has-rich-message .line-rich-message{width:100%;max-width:100%}
.message-bubble.has-rich-message .line-rich-carousel{width:100%;max-width:100%;gap:10px;overflow-x:auto;padding:2px 2px 8px}
.message-bubble.has-rich-message .line-rich-card{flex:0 0 min(300px,88%);width:auto;border-radius:16px}
.message-bubble.has-rich-message .line-rich-card-body{padding:13px}
.message-bubble.has-rich-message .line-rich-card-body>strong{font-size:.76rem;line-height:1.4}
.message-bubble.has-rich-message .line-rich-card-body>p{font-size:.62rem;line-height:1.5}
.message-bubble.has-rich-message .line-rich-card>img{max-height:170px}
.message-bubble.has-rich-message .line-rich-actions a,.message-bubble.has-rich-message .line-rich-actions span{min-height:32px;font-size:.58rem}
.assistant-citations{margin-top:9px;padding-top:8px;border-top:1px solid #e7e7ea}
.assistant-citations summary{cursor:pointer;color:#6e6e73;font-size:.6rem;font-weight:700;list-style:none}
.assistant-citations summary::-webkit-details-marker{display:none}
.assistant-citations summary:after{content:" ▾";color:#9b9ba0}
.assistant-citations[open] summary:after{content:" ▴"}
.assistant-citation-list{display:grid;gap:5px;margin-top:7px}
.assistant-citation-list a{display:flex;gap:6px;align-items:flex-start;color:#2563eb;font-size:.58rem;line-height:1.4;text-decoration:none}
.assistant-citation-list a span{flex:0 0 auto;color:#8e8e93;font-size:.52rem;font-weight:800}
@media(max-width:760px){.inbox-shell{height:auto;min-height:0}.conversation-panel{height:auto}.thread-panel{height:auto;min-height:620px}.message-bubble.has-rich-message{width:92%;max-width:92%}}