:root {
    --tx-navy: #0f1f3a;
    --tx-teal: #2dd4bf;
    --tx-teal-dark: #0f766e;
    --tx-surface: #f5f7fb;
    --tx-border: #e3e8f0;
    --tx-muted: #64748b;
    --tx-text: #1e293b;
}

html, body {
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    color: var(--tx-text);
    background: var(--tx-surface);
}

a, .btn-link {
    color: var(--tx-teal-dark);
}

.btn-primary {
    color: #fff;
    background-color: var(--tx-navy);
    border-color: var(--tx-navy);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #1c3461;
    border-color: #1c3461;
}

h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

h2 {
    font-size: 1.05rem;
    font-weight: 650;
}

.page-lead {
    color: var(--tx-muted);
    margin-bottom: 1.5rem;
}

.panel {
    background: #fff;
    border: 1px solid var(--tx-border);
    border-radius: 0.75rem;
    padding: 1.1rem 1.25rem;
    overflow: hidden;
}

.panel.empty {
    color: var(--tx-muted);
    text-align: center;
    padding: 2.5rem 1rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.stat {
    display: block;
    background: #fff;
    border: 1px solid var(--tx-border);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    color: inherit;
    text-decoration: none;
}

a.stat:hover {
    border-color: var(--tx-teal);
}

.stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    color: var(--tx-muted);
    font-size: 0.875rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.data-table {
    font-size: 0.925rem;
}

.data-table th {
    background: #f8fafc;
    color: var(--tx-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.65rem 1rem;
}

.data-table td {
    padding: 0.7rem 1rem;
    vertical-align: middle;
}

.data-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table tr.selected td {
    background: #ecfdf8;
}

.badge-soft {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #eef2f7;
    color: var(--tx-muted);
}

.badge-soft.ok { background: #dcfce7; color: #166534; }
.badge-soft.info { background: #e0f2fe; color: #075985; }
.badge-soft.warn { background: #fef3c7; color: #92400e; }

.kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1rem;
    margin: 0;
}

.kv dt {
    color: var(--tx-muted);
    font-weight: 500;
}

.kv dd {
    margin: 0;
}

.account-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem 1rem;
    background: linear-gradient(160deg, var(--tx-navy) 0%, #183056 100%);
}

.account-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.account-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
}

.account-mark {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: var(--tx-teal);
    color: var(--tx-navy);
    font-weight: 800;
}

.dev-signin {
    border: 1px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 0.9rem;
}

.dev-signin-head {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.6rem;
    font-size: 0.875rem;
}

.dev-signin-head span {
    color: var(--tx-muted);
    font-size: 0.8rem;
}

.demo-account {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid var(--tx-border);
    border-radius: 0.5rem;
    padding: 0.55rem 0.8rem;
    margin-bottom: 0.4rem;
}

.demo-account:hover {
    border-color: var(--tx-teal);
    background: #f0fdfa;
}

.demo-name {
    font-weight: 600;
}

.demo-detail {
    color: var(--tx-muted);
    font-size: 0.8rem;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Shown by Blazor only when an unhandled error occurs. */
#blazor-error-ui {
    background: #fef3c7;
    color: #78350f;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.back-link {
    display: inline-block;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    text-decoration: none;
}

.row-link {
    color: inherit;
    text-decoration: none;
}

.row-link:hover {
    color: var(--tx-teal-dark);
    text-decoration: underline;
}

.filter-tabs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-tab {
    border: 1px solid var(--tx-border);
    background: #fff;
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    font-size: 0.875rem;
    color: var(--tx-text);
}

.filter-tab.active {
    background: var(--tx-navy);
    border-color: var(--tx-navy);
    color: #fff;
}

.filter-tab .count {
    opacity: 0.65;
    margin-left: 0.25rem;
}

.lesson-video {
    width: 100%;
    max-width: 760px;
    border-radius: 0.5rem;
    background: #000;
}

.lesson-text {
    white-space: normal;
    line-height: 1.6;
    max-width: 760px;
}

.answer-correct {
    color: #166534;
    font-weight: 600;
}

.list-tools {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.list-tools .form-control {
    max-width: 280px;
}

.list-tools .form-select {
    max-width: 150px;
}

.data-table .select-col {
    width: 2.5rem;
    padding-right: 0;
}

.reminder-grid {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.reminder-grid label {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.field-tools {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.field-tools .form-select, .field-tools .form-control {
    width: auto;
    max-width: 220px;
}

.dropdown-lite {
    position: relative;
}

.dropdown-lite-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 20;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--tx-border);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(15, 31, 58, 0.12);
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.settings-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.settings-links a {
    display: block;
    background: #fff;
    border: 1px solid var(--tx-border);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    color: inherit;
    text-decoration: none;
}

.settings-links a:hover {
    border-color: var(--tx-teal);
}

.client-picks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.4rem;
}

.client-pick {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--tx-border);
    border-radius: 0.5rem;
    padding: 0.45rem 0.7rem;
    margin: 0;
    cursor: pointer;
}

.client-pick.on {
    border-color: var(--tx-teal);
    background: #f0fdfa;
}

.rule-editor {
    display: inline-flex;
    flex-direction: column;
    gap: 0.4rem;
}

.rule-line {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.rule-editor .form-select {
    width: auto;
}

.rule-editor .rule-days {
    width: 5.5rem;
}

.rule-editor input[type=date] {
    width: auto;
}

.course-pick {
    max-width: 360px;
}

.order-col {
    width: 3.5rem;
}

.template-card {
    color: inherit;
    text-decoration: none;
}

.template-card:hover {
    border-color: var(--tx-teal);
}

.tag-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--tx-border);
}

.brand-preview {
    border: 1px solid var(--tx-border);
    border-radius: 0.6rem;
    overflow: hidden;
    background: #f8fafc;
}

.brand-preview-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--preview-primary);
    color: #fff;
    padding: 0.6rem 0.8rem;
    font-weight: 600;
}

.brand-preview-head img {
    max-height: 28px;
    max-width: 120px;
}

.brand-preview-mark {
    display: inline-grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.4rem;
    background: var(--preview-accent);
    color: var(--preview-primary);
}

.brand-preview-card {
    margin: 0.8rem;
    background: #fff;
    border: 1px solid var(--tx-border);
    border-radius: 0.5rem;
    overflow: hidden;
    max-width: 220px;
}

.brand-preview-card-head {
    background: var(--preview-primary);
    color: #fff;
    padding: 0.6rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.brand-preview-button {
    display: inline-block;
    background: var(--preview-accent);
    color: var(--preview-primary);
    border-radius: 0.35rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.email-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .email-layout {
        grid-template-columns: 1fr;
    }
}

.email-kind {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--tx-border);
    background: #fff;
    padding: 0.65rem 0.9rem;
    text-align: left;
}

.email-kind.active {
    background: #f0fdfa;
    box-shadow: inset 3px 0 0 var(--tx-teal);
}

.email-preview {
    width: 100%;
    height: 520px;
    border: 1px solid var(--tx-border);
    border-radius: 0.5rem;
    background: #f5f7fb;
}

.progress-line {
    height: 6px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
    max-width: 220px;
    margin-bottom: 0.2rem;
}

.progress-line span {
    display: block;
    height: 100%;
    background: var(--tx-teal);
}

.engagement-row {
    display: grid;
    grid-template-columns: 160px 1fr 110px;
    gap: 0.75rem;
    align-items: center;
    margin: 0.35rem 0;
    font-size: 0.875rem;
}

.engagement-bar {
    height: 12px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
}

.engagement-bar span {
    display: block;
    height: 100%;
}

.engagement-bar .none { background: #94a3b8; }
.engagement-bar .opened { background: #60a5fa; }
.engagement-bar .started { background: #f59e0b; }
.engagement-bar .done { background: #16a34a; }

.engagement-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.print-only {
    display: none;
}

@media print {
    .sidebar, .topbar, .no-print, #blazor-error-ui {
        display: none !important;
    }

    .print-only {
        display: block;
    }

    .main, .content {
        padding: 0;
        background: #fff;
    }
}

.template-wrap {
    position: relative;
}

.template-wrap .template-card {
    display: block;
    height: 100%;
}

.template-wrap:has(.template-select) .template-card {
    padding-left: 2.4rem;
}

.template-select {
    position: absolute;
    top: 1.15rem;
    left: 0.9rem;
    z-index: 1;
}

.msp-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: -0.25rem 0 1rem;
    padding: 0.5rem 0.6rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.06);
    border-left: 3px solid var(--msp-color);
}

.msp-brand img {
    max-height: 26px;
    max-width: 90px;
}

.msp-mark {
    display: inline-grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 0.35rem;
    background: var(--msp-color);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

.msp-name {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
}

.tag-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.tag-picker legend {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.tag-choice {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    margin: 0 0.9rem 0.3rem 0;
    font-size: 0.9rem;
}

.tag-choice.d-block {
    display: block;
}

.meter-track {
    height: 8px;
    border-radius: 4px;
    background: var(--tx-border);
    overflow: hidden;
}

.meter-fill {
    display: block;
    height: 100%;
    border-radius: 4px;
}

.meter-fill.ok { background: #2f9e6e; }
.meter-fill.warn { background: #d9a400; }
.meter-fill.over { background: #d0542f; }

.lesson-document {
    width: 100%;
    height: 70vh;
    border: 1px solid var(--tx-border);
    border-radius: 0.5rem;
    background: #fff;
}

.suggest-box {
    padding: 1rem;
    border: 1px dashed var(--tx-teal);
    border-radius: 0.75rem;
    background: rgba(20, 184, 166, 0.04);
}

/* Help */
.help-link { white-space: nowrap; }
.help-list { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.help-card { display: block; padding: 0.9rem 1rem; border: 1px solid var(--bs-border-color); border-radius: 0.75rem; background: var(--bs-body-bg); color: inherit; text-decoration: none; }
.help-card:hover { border-color: var(--bs-primary); }
.help-article { max-width: 52rem; line-height: 1.6; }
.help-article h2 { font-size: 1.15rem; margin-top: 1.5rem; }
.help-article h2:first-child { margin-top: 0; }
.help-article h3 { font-size: 1rem; margin-top: 1.25rem; }
.help-article table { width: 100%; margin: 0.75rem 0; border-collapse: collapse; font-size: 0.925rem; }
.help-article th, .help-article td { border-bottom: 1px solid var(--bs-border-color); padding: 0.4rem 0.5rem; text-align: left; vertical-align: top; }
.help-article blockquote { margin: 1rem 0; padding: 0.6rem 0.9rem; border-left: 4px solid var(--bs-warning); background: var(--bs-warning-bg-subtle); border-radius: 0.25rem; }
.help-article blockquote p:last-child { margin-bottom: 0; }
.help-related { padding-left: 1.1rem; }

/* A suggested next step, shown until it's done */
.next-step { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; border-left: 4px solid var(--bs-primary); }

/* Guided setup on the Overview page */
.setup-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.setup-step { display: flex; align-items: center; gap: 0.85rem; padding: 0.65rem 0.75rem; border-radius: 0.6rem; }
.setup-step.next { background: var(--bs-primary-bg-subtle); }
.setup-step.done { color: var(--bs-secondary-color); }
.setup-mark { flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.85rem; font-weight: 600; border: 2px solid var(--bs-border-color); }
.setup-step.done .setup-mark { background: var(--bs-success); border-color: var(--bs-success); color: #fff; }
.setup-step.next .setup-mark { border-color: var(--bs-primary); color: var(--bs-primary); }
.setup-list li { margin-bottom: 0.35rem; }

/* Start Training Program */
.start-panel { border-left: 4px solid var(--bs-primary); }
.invite-dialog { max-width: 34rem; width: calc(100% - 2rem); }
.invite-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--bs-border-color); border-radius: 0.5rem; padding: 0.5rem 0.75rem; }
.invite-list .form-check { padding-top: 0.2rem; padding-bottom: 0.2rem; }

/* Save and error messages sit in a compact bar at the top, so they never push the page down. */
.main .alert-success,
.main .alert-danger {
    position: fixed;
    top: 0.6rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1090;
    width: max-content;
    max-width: min(720px, 92vw);
    max-height: 40vh;
    overflow: auto;
    margin: 0;
    padding: 0.45rem 2rem 0.45rem 0.9rem;
    box-shadow: 0 6px 20px rgba(15, 31, 58, 0.18);
    cursor: pointer;
}

.main .alert-success::after,
.main .alert-danger::after {
    content: "×";
    position: absolute;
    top: 0.3rem;
    right: 0.7rem;
    font-size: 1.1rem;
    line-height: 1.2;
}

.notice-hidden {
    display: none !important;
}
