/* Huntley Analytics brand palette (mirrors the marketing site's :root). */
:root {
    --ha-ink: #10202E;
    --ha-ink-soft: #44566A;
    --ha-paper: #F4F6F8;
    --ha-blue: #1A56C4;
    --ha-blue-deep: #0D2348;
    --ha-green: #2AA876;
    --ha-line: #DDE3E9;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f4f5f7;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main { flex: 1 0 auto; }

/* Powered-by footer, on every app page. */
.app-footer {
    flex-shrink: 0;
    text-align: center;
    padding: 22px 16px 26px;
}
.powered-by {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ha-ink-soft);
    text-decoration: none;
    font-size: 13px;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}
.powered-by:hover { opacity: 1; }
.powered-by img { display: block; }
.powered-by strong { color: var(--ha-blue-deep); font-weight: 700; }
.topnav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111827;
    color: white;
    padding: 14px 28px;
}
.topnav .brand-group { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: flex; align-items: center; opacity: 0.9; }
.brand-mark:hover { opacity: 1; }
.brand-mark img { display: block; }
.topnav .brand { font-weight: 600; font-size: 18px; }
.topnav .nav-actions { display: flex; align-items: center; gap: 12px; }
.topnav a.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #e5e7eb;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border: 1px solid #374151;
    border-radius: 8px;
    background: #1f2937;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.topnav a.nav-btn:hover { background: #374151; border-color: #4b5563; color: #fff; }
.topnav a.logout { color: #cbd5e1; text-decoration: none; font-size: 14px; }
.topnav a.logout:hover { color: white; }
.topnav .logout-form { margin: 0; display: flex; }
.topnav button.logout {
    background: none;
    border: none;
    padding: 0;
    color: #cbd5e1;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
}
.topnav button.logout:hover { color: white; }
.tier-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: 2px;
}
.tier-basic { background: #334155; color: #e2e8f0; }
.tier-pro { background: #1d4ed8; color: white; }
.tier-premium { background: #b45309; color: #fff7ed; }

main { max-width: 1500px; margin: 0 auto; padding: 24px 32px 48px; width: 100%; }

.login-box {
    max-width: 360px;
    margin: 80px auto;
    background: white;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.login-box h1 { font-size: 20px; margin-bottom: 20px; }
.login-box label { display: block; font-size: 13px; margin: 12px 0 4px; color: #475569; }
.login-box input {
    width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 14px;
}
.login-box button {
    width: 100%; margin-top: 18px; padding: 10px; background: var(--ha-blue); color: white;
    border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.login-box button:hover { background: var(--ha-blue-deep); }
.login-box .hint { margin-top: 14px; font-size: 12px; color: #94a3b8; }
.login-box .hint a { color: var(--ha-blue); text-decoration: none; }
.login-box .hint a:hover { text-decoration: underline; }
.login-box label.remember-device {
    display: flex; align-items: center; gap: 8px;
    margin: 14px 0 0; font-size: 13px; color: #475569; font-weight: 400; cursor: pointer;
}
.login-box label.remember-device input {
    width: auto; margin: 0; padding: 0; box-shadow: none;
}
.login-box .error {
    margin-top: 12px; padding: 9px 12px; border-radius: 8px;
    background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: 13px;
}
.login-box input:focus {
    outline: none; border-color: var(--ha-blue); box-shadow: 0 0 0 3px rgba(26, 86, 196, 0.16);
}

/* Product wordmark (GaugeBoard) — used on the login card. */
.product-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.product-brand img { display: block; }
.product-wordmark {
    font-size: 20px; font-weight: 800; letter-spacing: -0.01em; color: var(--ha-ink);
}
.product-wordmark span { color: var(--ha-blue); }

/* ---- Branded prospect intake pages ---- */
.intake-header {
    display: flex; align-items: center; gap: 10px;
    max-width: 460px; margin: 56px auto 0; padding: 0 4px;
}
.intake-header img { display: block; }
.intake-wordmark { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; color: var(--ha-ink); }
.intake-wordmark span { color: var(--ha-blue); }
.login-box.intake-box { margin-top: 16px; max-width: 460px; }
.intake-box h1 { font-size: 20px; }
.trust-row {
    display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 20px;
}
.trust-chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600; color: var(--ha-ink-soft);
    background: var(--ha-paper); border: 1px solid var(--ha-line);
    border-radius: 999px; padding: 4px 10px;
}
.trust-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ha-green); }
.intake-file {
    width: 100%; padding: 10px; border: 1px dashed var(--ha-line); border-radius: 8px;
    background: var(--ha-paper); font-size: 14px;
}
/* Numeric code entry (MFA setup + challenge): centered, spaced, monospace */
.login-box input#code {
    text-align: center; font-size: 22px; letter-spacing: 0.35em;
    padding-left: 0.35em; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

/* ---- Two-step verification setup ---- */
.login-box.mfa-setup { max-width: 460px; }
.mfa-setup h1 { margin-bottom: 18px; }
.mfa-steps {
    margin: 0 0 22px; padding-left: 20px;
    color: #475569; font-size: 14px; line-height: 1.55;
}
.mfa-steps li { margin-bottom: 6px; }
.mfa-steps li::marker { color: #2563eb; font-weight: 700; }
.mfa-qr {
    width: max-content; margin: 0 auto 18px; padding: 14px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.mfa-qr svg { display: block; width: 200px; height: 200px; }
.mfa-key { text-align: center; margin-bottom: 24px; }
.mfa-key-label {
    display: block; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.06em; color: #94a3b8; margin-bottom: 8px;
}
.mfa-key code {
    display: inline-block; padding: 9px 14px;
    background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 8px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 13px; letter-spacing: 0.08em; color: #0f172a; word-break: break-all;
}

.filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.filter-bar label { font-size: 13px; color: #475569; }
.filter-bar select {
    padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 14px; background: white;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
.kpi-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.kpi-label { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: 0.03em; }
.kpi-value { font-size: 22px; font-weight: 600; color: #0f172a; }

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.chart-box {
    background: white;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.chart-box h3 { font-size: 14px; margin: 0 0 12px; color: #334155; }
.chart-box-wide { grid-column: 1 / -1; }

.chart-row { margin-bottom: 16px; }
.kpi-row-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-row-4 { grid-template-columns: repeat(4, 1fr); }
.data-table td.warn { color: #b45309; font-weight: 700; }
.data-table td.ok { color: var(--ha-green); }
.admin-empty { color: #94a3b8; font-size: 13px; margin: 4px 0 0; }

.table-box {
    background: white;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 16px;
    overflow-x: auto;
}
.table-box h3 { font-size: 14px; margin: 0 0 12px; color: #334155; }
.table-box .section-note { font-weight: 400; color: #94a3b8; font-size: 12px; margin-left: 6px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: right;
    padding: 8px 10px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #e2e8f0;
}
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid #f1f5f9; color: #334155; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table td.pos { color: #16a34a; font-weight: 600; }
.data-table td.neg { color: #dc2626; font-weight: 600; }

.upsell {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    padding: 16px 20px;
    margin-top: 24px;
}
.upsell-lead { margin: 0 0 8px; color: #3730a3; font-size: 14px; }
.upsell ul { margin: 0; padding-left: 20px; color: #4338ca; font-size: 13px; }
.upsell li { margin: 3px 0; }

@media (max-width: 800px) {
    .kpi-row { grid-template-columns: repeat(2, 1fr); }
    .kpi-row-3 { grid-template-columns: 1fr; }
    .chart-row { grid-template-columns: 1fr; }
}

/* ---- Profile / Team (self-service account management) ---- */
.login-box .notice {
    margin-top: 12px; padding: 9px 12px; border-radius: 8px;
    background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; font-size: 13px;
}
.login-box h2.form-subhead {
    font-size: 15px; margin: 26px 0 4px; padding-top: 18px;
    border-top: 1px solid #e2e8f0; color: #0f172a;
}
.profile-meta { margin: 4px 0 8px; font-size: 14px; }
.profile-meta code, .team-box code, .credentials-banner code {
    background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px;
    padding: 2px 7px; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 13px; color: #0f172a;
}
.mfa-link { margin-top: 18px; }

.role-badge {
    display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.role-owner { background: #7c3aed; color: #fff; }
.role-member { background: #e2e8f0; color: #475569; }

.team-box { max-width: 640px; }
.team-table { width: 100%; border-collapse: collapse; margin: 12px 0 8px; font-size: 13px; }
.team-table th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
    color: #94a3b8; border-bottom: 1px solid #e2e8f0; padding: 6px 8px;
}
.team-table td { padding: 8px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.team-table .muted { color: #94a3b8; }
.team-table tr.row-inactive { opacity: 0.55; }
.row-actions { text-align: right; white-space: nowrap; }
.inline-form { display: inline; margin: 0; }
/* Scoped under .team-box so these beat the generic full-width `.login-box
   button` primary-button styling (which is otherwise more specific). */
.team-box .link-btn {
    width: auto;
    margin: 0;
    padding: 2px 8px;
    background: none;
    border: none;
    border-radius: 0;
    font: inherit;
    font-size: 12px;
    color: #2563eb;
    cursor: pointer;
}
.team-box .link-btn:hover { background: none; text-decoration: underline; }
.team-box .link-btn.danger { color: #dc2626; }
.credentials-banner {
    margin: 14px 0; padding: 12px 14px; border-radius: 8px;
    background: #fffbeb; border: 1px solid #fde68a;
}
.credentials-banner p { margin: 4px 0; font-size: 13px; }
