/* Loyal Hub — dashboard styles (Bootstrap 5 based) */
:root {
    --lh-primary: #1f4e8c;
    --lh-primary-dark: #163a69;
    --lh-accent: #f2a541;
    --lh-sidebar-bg: #ffffff;
    --lh-body-bg: #f4f6fa;
    --lh-border: #e3e7ef;
    --lh-sidebar-width: 250px;
    --bs-primary: #1f4e8c;
    --bs-primary-rgb: 31, 78, 140;
    --bs-link-color: #1f4e8c;
    --bs-link-color-rgb: 31, 78, 140;
    --bs-link-hover-color: #163a69;
}

body { background: var(--lh-body-bg); }

.btn-primary {
    --bs-btn-bg: var(--lh-primary);
    --bs-btn-border-color: var(--lh-primary);
    --bs-btn-hover-bg: var(--lh-primary-dark);
    --bs-btn-hover-border-color: var(--lh-primary-dark);
    --bs-btn-active-bg: var(--lh-primary-dark);
    --bs-btn-disabled-bg: var(--lh-primary);
    --bs-btn-disabled-border-color: var(--lh-primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--lh-primary);
    --bs-btn-border-color: var(--lh-primary);
    --bs-btn-hover-bg: var(--lh-primary);
    --bs-btn-hover-border-color: var(--lh-primary);
    --bs-btn-active-bg: var(--lh-primary);
}
.page-link { color: var(--lh-primary); }
.active > .page-link, .page-link.active { background-color: var(--lh-primary); border-color: var(--lh-primary); }

/* Top bar */
.lh-topbar {
    background: linear-gradient(90deg, var(--lh-primary-dark), var(--lh-primary));
    min-height: 56px;
    z-index: 1040;
}
.lh-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--lh-accent); color: #fff; font-size: 1rem;
}
.lh-logo-lg { width: 56px; height: 56px; border-radius: 14px; font-size: 1.6rem; }
.lh-logo-img { background: #fff; padding: 2px; overflow: hidden; }
.lh-logo-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* Full logo (logo.png) on a white chip so the dark wordmark reads on the blue top bar */
.lh-brand { display: inline-flex; align-items: center; background: #fff; border-radius: .5rem; padding: .2rem .55rem; margin-right: .5rem; }
.lh-brand img { height: 30px; width: auto; display: block; }
@media (max-width: 380px) { .lh-brand img { height: 24px; } }
.lh-auth-logo { width: 100%; max-width: 260px; height: auto; }

/* Shell */
.lh-shell { display: flex; min-height: calc(100vh - 56px); }
.lh-sidebar { background: var(--lh-sidebar-bg); border-right: 1px solid var(--lh-border); }
@media (min-width: 992px) {
    .lh-sidebar {
        width: var(--lh-sidebar-width); flex: 0 0 var(--lh-sidebar-width);
        position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
    }
}
.lh-main { flex: 1 1 auto; min-width: 0; padding: 1.5rem; }
@media (max-width: 575.98px) { .lh-main { padding: 1rem; } }

.lh-nav-section {
    font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: #8a94a6; padding: .75rem 1.25rem .25rem;
}
.lh-nav-toggle {
    display: flex; width: 100%; align-items: center; justify-content: space-between;
    background: none; border: 0; text-align: left; padding-top: .6rem; padding-bottom: .4rem;
}
.lh-nav-toggle:hover, .lh-nav-toggle:focus-visible { color: var(--lh-primary); }
.lh-nav-toggle .bi { font-size: .75rem; transition: transform .2s ease; }
.lh-nav-toggle.collapsed .bi { transform: rotate(-90deg); }
@media (prefers-reduced-motion: reduce) { .lh-nav-toggle .bi { transition: none; } }
.lh-nav .nav-link {
    display: flex; align-items: center; gap: .65rem;
    color: #334155; padding: .5rem 1.25rem; border-left: 3px solid transparent;
}
.lh-nav .nav-link i { font-size: 1.05rem; color: #64748b; }
.lh-nav .nav-link:hover { background: #f1f5fb; color: var(--lh-primary); }
.lh-nav .nav-link.active {
    background: #eaf1fb; color: var(--lh-primary); font-weight: 600; border-left-color: var(--lh-primary);
}
.lh-nav .nav-link.active i { color: var(--lh-primary); }

/* Page header */
.lh-page-header {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end;
    gap: 1rem; margin-bottom: 1.5rem;
}

/* Cards */
.card { border-color: var(--lh-border); border-radius: .75rem; }
.card-header { background: #fff; border-bottom-color: var(--lh-border); }
.card > .table-responsive:first-child .table thead th:first-child { border-top-left-radius: .75rem; }
.table > thead th {
    font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
    color: #64748b; font-weight: 600; background: #f8fafc; white-space: nowrap;
}
.lh-row-link { cursor: pointer; }

/* Stats */
.lh-stat { color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
.lh-stat:hover { transform: translateY(-2px); box-shadow: 0 .4rem 1rem rgba(15, 23, 42, .08); }
.lh-stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: .75rem;
}
.lh-stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; color: #0f172a; }
.lh-stat-label { color: #64748b; font-size: .875rem; }

.lh-dl dt { font-weight: 500; color: #64748b; }
.lh-dl dd { margin-bottom: .6rem; }
.lh-pre { white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; }
.lh-perm-table th { color: #334155; }
.lh-filters .form-label { margin-bottom: .2rem; color: #64748b; }
.lh-footer { border-top: 1px solid var(--lh-border); padding-top: 1rem; }

/* Auth / standalone pages */
.lh-auth {
    min-height: 100vh;
    background: radial-gradient(circle at top left, #2b64ad 0%, var(--lh-primary-dark) 55%, #0e2647 100%);
}
.lh-auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.lh-auth-card { width: 100%; max-width: 420px; border-radius: 1rem; }
.lh-auth-card.lh-wide { max-width: 980px; }

/* Password meter */
.lh-meter { height: 4px; border-radius: 2px; background: #e5e7eb; overflow: hidden; margin-top: .35rem; }
.lh-meter > span { display: block; height: 100%; width: 0; transition: width .2s ease; }

/* Status filter chips */
.lh-status-strip { display: flex; flex-wrap: wrap; gap: .4rem; }
.lh-chip {
    display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px;
    border: 1px solid var(--lh-border); background: #fff; color: #334155; font-size: .8rem; text-decoration: none;
}
.lh-chip span { background: #eef2f7; border-radius: 999px; padding: 0 .45rem; font-weight: 600; }
.lh-chip:hover { border-color: var(--lh-primary); color: var(--lh-primary); }
.lh-chip.active { background: var(--lh-primary); border-color: var(--lh-primary); color: #fff; }
.lh-chip.active span { background: rgba(255,255,255,.2); }

/* Lifecycle progress */
.lh-lifecycle { display: flex; flex-wrap: wrap; gap: .25rem; }
.lh-step {
    font-size: .75rem; padding: .3rem .6rem; background: #f1f5f9; color: #64748b; border-radius: .35rem;
}
.lh-step.current { background: var(--lh-primary); color: #fff; font-weight: 600; }

/* Merchant terminal (OBJ-038): large touch targets, minimal chrome */
.lh-terminal { background: #eef2f7; min-height: 100vh; }
.lh-terminal-bar { background: var(--lh-primary); color: #fff; position: sticky; top: 0; z-index: 10; }
.lh-terminal-bar .lh-logo { background: rgba(255,255,255,.18); color: #fff; }
.lh-terminal-id { line-height: 1.2; min-width: 0; }
.lh-terminal-id .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lh-terminal-card { border-radius: 1rem; }
.lh-terminal-input { font-size: 1.35rem; letter-spacing: .02em; }
.lh-otp-input { font-size: 2rem; letter-spacing: .5em; font-variant-numeric: tabular-nums; }
.lh-op-tabs { display: flex; flex-wrap: wrap; gap: .5rem; }
.lh-op-tabs .btn { flex: 1 1 auto; padding: .6rem .9rem; }
.lh-terminal-done { font-size: 3.5rem; color: #16a34a; line-height: 1; }
.lh-secret { font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; word-break: break-all; user-select: all; }
/* Flex columns must be allowed to shrink below wide inputs (e.g. the OTP field) on phones. */
.lh-terminal .row > [class*="col"] { min-width: 0; }

/* Campaigns (Phase 5) */
.lh-sms { white-space: pre-wrap; font-family: inherit; background: #f8fafc; border: 1px solid var(--lh-border); border-radius: .5rem; padding: .75rem; }
.lh-w-0 { width: 0; } .lh-w-10 { width: 10%; } .lh-w-20 { width: 20%; } .lh-w-30 { width: 30%; } .lh-w-40 { width: 40%; } .lh-w-50 { width: 50%; }
.lh-w-60 { width: 60%; } .lh-w-70 { width: 70%; } .lh-w-80 { width: 80%; } .lh-w-90 { width: 90%; } .lh-w-100 { width: 100%; }
.lh-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.lh-bars > div { flex: 1 1 0; background: #c7d2fe; border-radius: 3px 3px 0 0; position: relative; min-width: 4px; }
.lh-bars > div > span { position: absolute; bottom: 0; left: 0; right: 0; background: var(--lh-primary); border-radius: 3px 3px 0 0; }
.lh-h-0 { height: 0; } .lh-h-5 { height: 5%; } .lh-h-10 { height: 10%; } .lh-h-20 { height: 20%; } .lh-h-30 { height: 30%; } .lh-h-40 { height: 40%; } .lh-h-50 { height: 50%; }
.lh-h-60 { height: 60%; } .lh-h-70 { height: 70%; } .lh-h-80 { height: 80%; } .lh-h-90 { height: 90%; } .lh-h-100 { height: 100%; }

/* Tickets (Phase 6) */
.lh-pre { white-space: pre-wrap; }
.lh-internal { background: #fffbeb; }
.lh-unread { background: rgba(13, 110, 253, .05); }

/* ---- Self-service portal (Phase 7) ---- */
.lh-portal { background: #f5f7fb; }
.lh-portal-active { border-bottom: 2px solid rgba(255, 255, 255, .85); }
.lh-kpi-table th[scope="row"] { white-space: nowrap; }
.lh-trend { width: 100%; height: auto; display: block; }
.lh-trend-bar { fill: #2563eb; opacity: .85; }
.lh-trend-bar:hover { opacity: 1; }
.lh-trend-axis { stroke: #cbd5e1; stroke-width: 1; }
.lh-trend-label { font-size: 11px; fill: #64748b; }
.lh-map { height: 480px; width: 100%; border-radius: .375rem .375rem 0 0; }
@media (max-width: 575.98px) { .lh-map { height: 360px; } }
.lh-print { background: #fff; }
.lh-print-page { max-width: 210mm; }
.lh-print-page h1 { font-size: 1.5rem; }
.lh-print-page table { font-size: .85rem; }
@media print {
    @page { size: A4; margin: 14mm; }
    .lh-print-page { max-width: none; padding: 0; }
    .lh-print-page .card { break-inside: avoid; }
}

/* Phase 9 — department workspaces */
.lh-pre-text { white-space: pre-wrap; word-break: break-word; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "\F282"; font-family: "bootstrap-icons"; float: right; transition: transform .15s; }
details.card[open] > summary::after { transform: rotate(180deg); }
.lh-kpi-sm { font-size: 1.35rem; font-weight: 600; }

/* Phase 10 — sales pipeline and project timeline */
.lh-pipeline { display: grid; grid-template-columns: repeat(7, minmax(7.5rem, 1fr)); gap: .5rem; overflow-x: auto; }
.lh-pipeline-step { color: inherit; }
.lh-pipeline-step:hover { border-color: var(--bs-primary); }
.lh-gantt-row { display: grid; grid-template-columns: minmax(8rem, 28%) 1fr; gap: .75rem; align-items: center; margin-bottom: .35rem; }
.lh-gantt-track { position: relative; height: 1rem; background: #f1f5f9; border-radius: .25rem; }
.lh-gantt-bar { position: absolute; top: 0; bottom: 0; border-radius: .25rem; min-width: .5rem; }
.lh-gantt-today { position: absolute; top: -.2rem; bottom: -.2rem; border-left: 2px dashed #64748b; z-index: 1; }
.lh-gantt-open, .lh-gantt-key.lh-gantt-open { background: #94a3b8; }
.lh-gantt-in_progress, .lh-gantt-blocked, .lh-gantt-key.lh-gantt-in_progress { background: #2563eb; }
.lh-gantt-blocked { background: #d97706; }
.lh-gantt-completed, .lh-gantt-key.lh-gantt-completed { background: #16a34a; }
.lh-gantt-cancelled { background: #cbd5e1; }
.lh-gantt-overdue, .lh-gantt-key.lh-gantt-overdue { background: #dc2626; }
.lh-gantt-key { display: inline-block; width: .8rem; height: .6rem; border-radius: .15rem; vertical-align: middle; }
@media (max-width: 575.98px) { .lh-gantt-row { grid-template-columns: 1fr; gap: .15rem; } }

/* Phase 11 — public API catalog */
body.lh-docs { background: var(--bs-body-bg, #fff); }
.lh-docs .lh-topbar { position: sticky; top: 0; z-index: 10; }
.lh-docs-toc { position: sticky; top: 4.5rem; max-height: calc(100vh - 5.5rem); overflow-y: auto; padding-right: .5rem; }
.lh-code { background: #0f172a; color: #e2e8f0; border-radius: .5rem; padding: .75rem 1rem; font-size: .8rem; white-space: pre-wrap; word-break: break-word; margin: 0; }
.lh-docs section { scroll-margin-top: 4.5rem; }
.lh-docs article { scroll-margin-top: 4.5rem; }
