/* Analytics dashboard — design tokens and shared card language.
   Scoped to .dash so it never bleeds into the rest of the Bootstrap app. */

:root {
    --dash-bg: #F4F4F1;
    /* App background: a soft diagonal wash from lavender (main numbers) to peach (sub numbers) */
    --page-wash: linear-gradient(135deg, #E9EDF8 0%, #F3EEF4 50%, #FBEFE2 100%);
    --dash-card: #FFFFFF;
    --dash-border: #E3E3DE;
    --dash-line: #EDEDE8;
    --dash-text: #1A1A18;
    --dash-muted: #6E6E68;
    --dash-faint: #9A9A94;
    --dash-indigo: #2D3E73;
    --dash-hot: #B3261E;
    --dash-cold: #7A8699;
    --dash-amber: #C2710C;
    --dash-never: #D8D8D2;
    --dash-guess: #1F7A4D;
    --dash-ink: #1A1A18;
}

.dash-page,
.dash,
.app-header,
.auth-page {
    font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    color: var(--dash-text);
}

/* Whole-page surface */
.dash-page {
    background: transparent;
    min-height: calc(100vh - 56px);
    padding: 22px 28px 44px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Dashboard block inside the page */
.dash {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dash-mono {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ---- Section heading ---- */
.dash-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.dash-head h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--dash-text);
}

.dash-head .dash-range {
    font-size: 14px;
    color: var(--dash-muted);
}

.dash-section-label {
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--dash-faint);
    font-weight: 500;
    margin-top: 4px;
}

/* ---- Cards ---- */
.dash-card {
    background: var(--dash-card);
    border: 1px solid #E3E6F0;
    border-radius: 20px;
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dash-card.dash-dashed {
    border-style: dashed;
    border-color: #C3CAE4;
    background: #FAFAFD;
}

.dash-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: -18px -22px 0;
    padding: 13px 22px;
    background: #DCE1EF;
    border-bottom: 1px solid #C3CAE4;
    border-radius: 19px 19px 0 0;
}

.dash-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1F2A52;
}

.dash-card-sub {
    font-size: 12px;
    color: #4A4A45;
    font-weight: 400;
}

.dash-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ---- Grids ---- */
.dash-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dash-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.dash-grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }

@media (max-width: 1200px) {
    .dash-grid-3, .dash-grid-4, .dash-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .dash-grid-2, .dash-grid-3, .dash-grid-4, .dash-grid-5 { grid-template-columns: minmax(0, 1fr); }
    .dash { padding: 16px; }
}

/* ---- KPI tiles ---- */
.dash-kpi {
    background: var(--dash-card);
    border: 1px solid #E3E6F0;
    border-radius: 20px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dash-kpi-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #4A5A94;
}

.dash-kpi-value {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 28px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--dash-text);
}

.dash-kpi-note {
    font-size: 13px;
    color: var(--dash-muted);
}

/* ---- Chart wrapper ---- */
.dash-chart {
    position: relative;
    width: 100%;
}

/* ---- Legend chips ---- */
.dash-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--dash-muted);
    flex-wrap: wrap;
}

.dash-legend span.dash-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
    margin-right: 6px;
    vertical-align: -1px;
}

/* ---- Number tiles ---- */
.dash-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
}

.dash-tile {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 17px;
    font-weight: 500;
    color: #2D3E73;
    background: #FAFAFD;
    border: 1.5px dashed #B3BBDA;
    border-radius: 12px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-tile-sm {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 13px;
    padding: 4px 9px;
    background: #EEF0F7;
    border-radius: 8px;
    color: #1F2A52;
}

/* ---- Slot cards (positional) ---- */
.dash-slot {
    border: 1px solid #E3E6F0;
    background: #F6F7FB;
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dash-slot-label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #4A5A94; }

.dash-slot-top {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 17px;
    font-weight: 600;
    color: #FFFFFF;
    background: #2D3E73;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---- Compact data table ---- */
.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.dash-table th {
    text-align: left;
    font-weight: 500;
    font-size: 12px;
    color: var(--dash-muted);
    padding: 6px 8px;
    border-bottom: 1px solid var(--dash-line);
}

.dash-table td {
    padding: 7px 8px;
    border-bottom: 1px solid var(--dash-line);
    color: var(--dash-text);
}

.dash-table tr:last-child td { border-bottom: none; }

.dash-table td.dash-num {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ---- Stat block (big percentage) ---- */
.dash-stat {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 34px;
    font-weight: 500;
    color: var(--dash-text);
    line-height: 1.1;
}

.dash-note {
    font-size: 12px;
    color: var(--dash-muted);
    line-height: 1.6;
}

/* ---- Prediction ---- */
.dash-pred-badge {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 13px;
    font-weight: 500;
    background: #2D3E73;
    color: #FFFFFF;
    border-radius: 6px;
    padding: 4px 9px;
    margin-right: 3px;
    display: inline-block;
}

.dash-pred-badge-sub {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 13px;
    font-weight: 500;
    background: var(--dash-amber);
    color: #FFFFFF;
    border-radius: 6px;
    padding: 4px 9px;
    margin-right: 3px;
    display: inline-block;
}

.dash-rank {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 12px;
    color: var(--dash-faint);
    width: 18px;
}

.dash-conf {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 13px;
    font-weight: 500;
    color: var(--dash-text);
    white-space: nowrap;
}

.dash-family {
    font-size: 12px;
    color: var(--dash-muted);
}

.dash-alert {
    background: #FDF4E7;
    border: 1px solid #E8C98A;
    border-radius: 12px;
    padding: 18px 22px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.dash-alert-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--dash-amber);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-alert-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.dash-alert-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dash-alert-title {
    font-size: 15px;
    font-weight: 600;
    color: #8A4B04;
    letter-spacing: 0.01em;
}

.dash-alert-text {
    font-size: 14.5px;
    line-height: 1.65;
    color: #5C4218;
}

.dash-alert-text strong {
    font-weight: 600;
    color: #8A4B04;
}

/* The key clause: permanently bold, plus a slow attention pulse that runs
   5 cycles (~5.5s) on load and then settles. ~0.9 Hz — well under the 3 Hz
   seizure threshold, and disabled outright for reduced-motion users. */
.dash-alert-core {
    font-weight: 600;
    color: #8A4B04;
    border-radius: 5px;
    padding: 1px 4px;
    margin: 0 -2px;
    animation: dash-attention 1.1s ease-in-out 5;
}

@keyframes dash-attention {
    0%, 100% { background-color: rgba(247, 217, 160, 0); }
    50%      { background-color: rgba(240, 186, 90, 0.95); }
}

@media (prefers-reduced-motion: reduce) {
    .dash-alert-core { animation: none; background-color: rgba(240, 186, 90, 0.35); }
}

.dash-empty {
    font-size: 13px;
    color: var(--dash-muted);
    line-height: 1.6;
}

/* ---- Page header ---- */
.dash-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.dash-title {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    color: var(--dash-text);
}

.dash-badge {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 999px;
    background: #E8EAF1;
    color: var(--dash-indigo);
    white-space: nowrap;
}

.dash-badge-sub {
    background: #FBEFD6;
    color: #8A4B04;
}

.dash-badge-neutral {
    background: #EDEDE8;
    color: #4A4A45;
}

/* ---- Forms ---- */
.dash-form-grid {
    display: grid;
    gap: 14px;
    align-items: end;
}

.dash-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.dash-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--dash-muted);
}

.dash-label-accent {
    color: #8A4B04;
}

.dash-input,
.dash-textarea {
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 14px;
    color: var(--dash-text);
    background: #FFFFFF;
    border: 1px solid #C9C9C2;
    border-radius: 8px;
    padding: 8px 11px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.dash-textarea {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    line-height: 1.6;
    resize: vertical;
}

.dash-input:focus,
.dash-textarea:focus {
    outline: none;
    border-color: var(--dash-indigo);
    box-shadow: 0 0 0 3px rgba(45, 62, 115, 0.12);
}

.dash-input-sm {
    padding: 6px 9px;
    font-size: 13px;
}

.dash-hint {
    font-size: 12px;
    color: var(--dash-faint);
}

/* ---- Buttons ---- */
.dash-btn {
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid #C9C9C2;
    background: #FFFFFF;
    color: var(--dash-text);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.dash-btn:hover { background: #F0F0EC; border-color: #A8A8A0; }
.dash-btn:active { transform: scale(0.99); }

.dash-btn-primary {
    background: var(--dash-indigo);
    border-color: var(--dash-indigo);
    color: #FFFFFF;
}
.dash-btn-primary:hover { background: #24325E; border-color: #24325E; }

.dash-btn-success {
    background: #1F7A4D;
    border-color: #1F7A4D;
    color: #FFFFFF;
}
.dash-btn-success:hover { background: #17603C; border-color: #17603C; }

.dash-btn-sm {
    font-size: 13px;
    padding: 6px 13px;
}

.dash-btn-danger {
    color: #B3261E;
    border-color: #E3C4C2;
}
.dash-btn-danger:hover { background: #FBEDEC; border-color: #D79A96; }

.dash-btn-icon {
    font-size: 13px;
    line-height: 1;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid #E3C4C2;
    background: #FFFFFF;
    color: #B3261E;
    cursor: pointer;
}
.dash-btn-icon:hover { background: #FBEDEC; }

.dash-error {
    background: #FBEDEC;
    border: 1px solid #E3C4C2;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #8A1F19;
}

.dash-success {
    background: #E8F4EC;
    border: 1px solid #BFDCC9;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #17603C;
}

.dash-input-locked {
    background: #F4F4F1;
    color: var(--dash-muted);
    cursor: not-allowed;
}

.dash-input-lockwrap {
    position: relative;
}

.dash-input-lockwrap .dash-input {
    padding-right: 34px;
}

.dash-lock {
    position: absolute;
    right: 11px;
    top: 50%;
    width: 15px;
    height: 15px;
    transform: translateY(-50%);
    color: var(--dash-faint);
    pointer-events: none;
}

/* ---- Profile ---- */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    align-items: start;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.profile-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    align-items: start;
}

.profile-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
}

/* ---- Master array tiles ---- */
.dash-array {
    background: var(--dash-card);
    border: 1px solid var(--dash-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: border-color 0.12s ease, transform 0.12s ease;
}

.dash-array:hover {
    border-color: #A8B0C8;
    transform: translateY(-1px);
}

.dash-array-body {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.dash-array-name {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--dash-text);
}

.dash-array-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dash-array-foot {
    border-top: 1px solid var(--dash-line);
    padding: 11px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.dash-array-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--dash-indigo);
}

/* ---- Highlight grid, retuned to the dashboard palette ---- */
.dash-page .highlight-grid {
    margin: 0;
    border-color: var(--dash-line);
}

.dash-page .highlight-grid thead th {
    background: #2A2A28 !important;
    color: #F4F4F1;
    border-color: #3A3A37;
    font-weight: 500;
}

.dash-page .highlight-grid td {
    border-color: var(--dash-line);
}

.dash-page .highlight-grid .totals-row td {
    background: #2A2A28;
    border-top: 2px solid #3A3A37 !important;
}

.dash-page .draw-link {
    color: var(--dash-indigo);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

.dash-page .draw-link:hover {
    color: #B3261E;
}

.dash-grid-scroll {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--dash-line);
}

/* ---- App header (deep indigo) ---- */
.app-header {
    background: linear-gradient(90deg, #1F2A52 0%, #2D3E73 100%);
    box-shadow: 0 2px 8px rgba(31, 42, 82, 0.25);
    padding: 0 28px;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}

.app-brand {
    font-size: 17px;
    font-weight: 600;
    color: #FFFFFF;
    text-decoration: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-brand:hover { color: #FFFFFF; }
.app-brand svg { border-radius: 9px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35); }

.app-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-grow: 1;
}

.app-nav a {
    font-size: 14px;
    color: #D7DCEE;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 999px;
    white-space: nowrap;
    transition: background 0.12s ease, color 0.12s ease;
}

.app-nav a:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
}

.app-nav a.active {
    color: #1F2A52;
    font-weight: 500;
    background: #DCE1EF;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.app-lang {
    font-family: inherit;
    font-size: 13px;
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    padding: 7px 12px;
}

.app-lang:focus {
    outline: none;
    border-color: #DCE1EF;
}

.app-lang option { color: #1A1A18; background: #FFFFFF; }

.app-user {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 14px;
    color: #FFFFFF;
    white-space: nowrap;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 12px;
    transition: background 0.12s ease;
}

.app-user:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
}

.app-user-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.app-user-name {
    font-weight: 500;
}

.app-user-email {
    font-size: 12px;
    color: #B3BBDA;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.app-role {
    font-size: 11px;
    font-weight: 500;
    color: #FFD9A3;
    background: rgba(245, 169, 74, 0.22);
    border-radius: 999px;
    padding: 3px 9px;
    margin-left: 6px;
    white-space: nowrap;
}

.app-btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #FFFFFF;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    padding: 8px 16px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.app-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
    color: #FFFFFF;
}

@media (max-width: 720px) {
    .app-header { padding: 10px 16px; gap: 12px; }
    .app-nav { width: 100%; order: 3; }
}

/* ---- Sign-in / register ---- */
.auth-page {
    min-height: 100vh;
    background: #EEF0F7 var(--page-wash) fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.auth-card {
    width: 100%;
    max-width: 396px;
    background: var(--dash-card);
    border: 1px solid var(--dash-border);
    border-radius: 14px;
    padding: 34px 32px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
}

.auth-mark {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 15px;
    font-weight: 500;
    color: #FFFFFF;
    background: var(--dash-indigo);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-title {
    margin: 0;
    font-size: 21px;
    font-weight: 600;
    color: var(--dash-text);
}

.auth-sub {
    margin: 0;
    font-size: 13px;
    color: var(--dash-muted);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-divider span.auth-rule {
    flex-grow: 1;
    height: 1px;
    background: var(--dash-border);
}

.auth-divider span.auth-word {
    font-size: 12px;
    color: var(--dash-faint);
}

.auth-providers {
    display: flex;
    gap: 10px;
}

.auth-providers .dash-btn { flex-grow: 1; }

.auth-foot {
    margin: 0;
    text-align: center;
    font-size: 13px;
    color: var(--dash-muted);
}

.auth-check {
    display: flex;
    align-items: center;
    gap: 9px;
}

.auth-check input {
    width: 15px;
    height: 15px;
    accent-color: var(--dash-indigo);
}

.auth-check label {
    font-size: 13px;
    color: #4A4A45;
    margin: 0;
}

.auth-validation {
    font-size: 12px;
    color: #B3261E;
}

/* ---- "What does this mean?" explanations ---- */
.dash-card-head-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dash-explain-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 4px;
    border: 1px solid var(--dash-border);
    border-radius: 999px;
    background: var(--dash-card);
    color: var(--dash-indigo);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}

.dash-explain-btn:hover { background: #EEF1F8; border-color: #C3CBE0; }
.dash-explain-btn:focus-visible { outline: 2px solid var(--dash-indigo); outline-offset: 2px; }
.dash-explain-btn.open { background: #EEF1F8; border-color: #C3CBE0; }

.dash-explain-icon {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--dash-indigo);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

/* Animates height by moving the row from 0fr to 1fr — no fixed max-height guess needed. */
.dash-explain {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows .3s ease, opacity .25s ease, margin-top .3s ease;
    margin-top: -14px; /* cancels the card's flex gap while closed */
}

.dash-explain.open {
    grid-template-rows: 1fr;
    opacity: 1;
    margin-top: 0;
}

.dash-explain-inner { overflow: hidden; min-height: 0; }

.dash-explain-box {
    background: #F5F7FC;
    border-left: 3px solid var(--dash-indigo);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--dash-text);
}

.dash-explain-box p { margin: 0; }
.dash-explain-box p + p { margin-top: 8px; }

.dash-kpi .dash-explain { margin-top: -5px; }
.dash-kpi .dash-explain.open { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
    .dash-explain { transition: none; }
}

/* ---- Draw-shape walkthrough (inside the explanation panel) ---- */
.shape-demo {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #C3CBE0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shape-demo-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--dash-indigo);
}

.shape-demo p { margin: 0; }

.shape-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--dash-card);
    border: 1px solid var(--dash-border);
    border-radius: 10px;
    padding: 12px 14px;
}

.shape-step-no {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--dash-indigo);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
}

.shape-step-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shape-answer {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-weight: 700;
    color: var(--dash-indigo);
    background: #E4E8F3;
    border-radius: 6px;
    padding: 1px 7px;
}

/* number balls */
.shape-balls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.shape-ball {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 4px;
    border-radius: 50%;
    background: #FFE45C;
    border: 2px solid #E0B800;
    color: #1A1A18;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-weight: 700;
    font-size: 14px;
    transition: opacity .2s, transform .2s;
}

.shape-ball-sm { min-width: 26px; height: 26px; font-size: 12px; border-width: 1.5px; }
.shape-ball.is-dim { opacity: .35; }
.shape-ball.is-pick { background: #1F7A4D; border-color: #145C39; color: #fff; transform: scale(1.12); }
.shape-ball.is-pair { background: #C2710C; border-color: #8A4B04; color: #fff; }

.shape-link {
    width: 14px;
    height: 4px;
    margin: 0 -6px;
    background: #8A4B04;
    border-radius: 2px;
}

/* number line for the span */
.shape-line {
    position: relative;
    height: 58px;
    margin: 4px 14px 0;
}

.shape-line-track,
.shape-line-span {
    position: absolute;
    top: 26px;
    height: 6px;
    border-radius: 3px;
}

.shape-line-track { left: 0; right: 0; background: #DDE2ED; }
.shape-line-span { background: var(--dash-indigo); }

.shape-line-dot {
    position: absolute;
    top: 22px;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    border-radius: 50%;
    background: #FFE45C;
    border: 2px solid #E0B800;
}

.shape-line-dot.is-end { background: var(--dash-indigo); border-color: var(--dash-indigo); }

.shape-line-num {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--dash-text);
}

.shape-line-edge {
    position: absolute;
    top: 38px;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--dash-muted);
}

/* the sum written out */
.shape-sum {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 15px;
    overflow-wrap: anywhere;
}

/* decade boxes */
.shape-buckets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
    gap: 8px;
}

.shape-bucket {
    border: 1.5px solid #C3CBE0;
    border-radius: 8px;
    background: #F5F7FC;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.shape-bucket.is-empty { opacity: .55; border-style: dashed; }

.shape-bucket-label {
    width: 100%;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--dash-muted);
    background: #E4E8F3;
    padding: 3px 0;
}

.shape-bucket-balls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    min-height: 42px;
}

.shape-bucket-count {
    width: 100%;
    text-align: center;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    background: var(--dash-indigo);
    padding: 2px 0;
}

.shape-bucket.is-empty .shape-bucket-count { background: #8D9CC4; }

/* ---- Prediction disclaimer: punchy layout ---- */
.dash-alert { border-width: 1.5px; border-left: 6px solid var(--dash-amber); }
.dash-alert-body { gap: 8px; }

.dash-alert-title {
    text-transform: uppercase;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.dash-alert-headline {
    font-size: 18px;
    line-height: 1.45;
    font-weight: 700;
    color: #6B3A03;
}

.dash-alert-headline .dash-alert-core { font-weight: 800; color: inherit; }

.dash-alert-tail { font-weight: 700; color: #8A4B04; }

/* ---- Form layout: labels on one line, action button on its own row ---- */
.dash-form-grid.dash-form-top { align-items: start; }

.dash-form-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 2px;
}

/* ---- Localized date field ---- */
.dash-date { position: relative; }
.dash-date .dash-input { padding-right: 38px; }

.dash-date-native {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    border: 0;
    padding: 0;
}

.dash-date-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--dash-muted);
    cursor: pointer;
}

.dash-date-btn:hover { background: #EEF1F8; color: var(--dash-indigo); }
.dash-date-btn svg { width: 17px; height: 17px; }
.dash-input-sm + .dash-date-native + .dash-date-btn { width: 24px; height: 24px; }

/* ---- Draw detail: drawn-number balls ---- */
.draw-balls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 0 6px;
}

.draw-ball {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 26px;
    font-weight: 600;
    color: var(--dash-ink);
    background: radial-gradient(circle at 32% 28%, #FFF7A8 0%, #FFE600 45%, #E6C800 100%);
    box-shadow: 0 3px 8px rgba(26, 26, 24, 0.18), inset 0 -3px 0 rgba(0, 0, 0, 0.08);
}

.draw-ball-sub {
    color: #FFFFFF;
    background: radial-gradient(circle at 32% 28%, #FFC266 0%, #FF9900 45%, #D97E00 100%);
}

.draw-ball-divider {
    width: 2px;
    height: 44px;
    margin: 0 8px;
    border-radius: 1px;
    background: var(--dash-border);
}

@media (max-width: 576px) {
    .draw-balls { gap: 9px; }
    .draw-ball { width: 46px; height: 46px; font-size: 19px; }
    .draw-ball-divider { height: 32px; margin: 0 4px; }
}

/* ---- Draw detail: ticket input ---- */
.dash-textarea.is-invalid,
.dash-textarea.is-invalid:focus {
    border-color: var(--dash-hot);
    box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.12);
}

.ticket-field-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    min-height: 18px;
    font-size: 12px;
}

.ticket-field-error { color: #8A1F19; }

.ticket-count {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    color: var(--dash-faint);
    white-space: nowrap;
}

.ticket-count.over { color: var(--dash-hot); font-weight: 500; }

.dash-btn:disabled,
.dash-btn:disabled:hover {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}
.dash-btn-success:disabled:hover { background: #1F7A4D; border-color: #1F7A4D; }

.ticket-hits {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 500;
    white-space: nowrap;
    background: #F0F0EC;
    color: var(--dash-muted);
}

.ticket-hits.has-hits {
    background: #E8F4EC;
    color: var(--dash-guess);
}

/* ---- Highlight grid (master detail): panels + chips ---- */
.hg-scroll {
    overflow-x: auto;
    padding-bottom: 4px;
}

.hg {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 12px;
}

.hg th,
.hg td {
    padding: 0;
    height: 32px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

/* Number columns */
.hg .hg-num {
    min-width: 17px;
    border-right: 1px solid rgba(45, 62, 115, 0.07);
    border-bottom: 1px solid rgba(45, 62, 115, 0.07);
}

.hg tbody .hg-main {
    background: color-mix(in srgb, #DCE1EF calc(var(--t, 0) * 100%), #F6F7FB);
}

.hg tbody .hg-sub {
    background: #FDF0DD;
    border-color: rgba(194, 113, 12, 0.12);
}

.hg thead th {
    font-size: 11px;
    font-weight: 500;
    color: var(--dash-muted);
    height: 30px;
    border-bottom: 1px solid rgba(45, 62, 115, 0.12);
}

.hg thead .hg-main { background: color-mix(in srgb, #D3D9EB calc(var(--t, 0) * 100%), #EEF0F7); }
.hg thead .hg-sub  { background: #FBE2BE; color: #8A4B04; border-bottom-color: rgba(194, 113, 12, 0.2); }

/* Rounded panel corners: main and sub sections read as two cards */
.hg thead .hg-main:nth-child(2)  { border-top-left-radius: 12px; }
.hg thead .hg-gap + .hg-sub       { border-top-left-radius: 12px; }
/* Last number column before a non-number column (gap, hits, actions) closes the panel */
.hg thead .hg-num:has(+ :not(.hg-num)) { border-top-right-radius: 12px; }

.hg .hg-gap {
    min-width: 10px;
    width: 10px;
    background: transparent;
    border: 0;
}

/* Chips */
.hg-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 16px;
    width: calc(100% - 3px);
    max-width: 24px;
    height: 22px;
    padding: 0 1px;
    border-radius: 6px;
    font-weight: 500;
    color: var(--dash-ink);
    background: color-mix(in srgb, #2D3E73 calc(var(--t, 0) * 100%), #D6DBEB);
    box-shadow: 0 1px 2px rgba(26, 26, 24, 0.12);
}

.hg-chip-dark { color: #FFFFFF; }

.hg-chip-sub {
    background: #F5A94A;
    color: #4A2802;
}

/* Date column (sticky pills) */
.hg .hg-date-col {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 1%;
    background: var(--dash-card);
    padding: 0 8px 0 0;
    text-align: left;
}

.hg thead .hg-date-col {
    font-size: 12px;
    color: var(--dash-text);
    padding-left: 10px;
}

.hg-date {
    display: block;
    white-space: nowrap;
    padding: 4px 9px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #1F2A52;
    text-decoration: none;
    background: linear-gradient(180deg, #D7DCEE 0%, #C3CAE4 100%);
    border: 1px solid #B3BBDA;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: background 0.12s ease, color 0.12s ease;
}

.hg-date:hover {
    color: #FFFFFF;
    background: linear-gradient(180deg, #4A5A94 0%, #2D3E73 100%);
    border-color: #2D3E73;
}

/* Row hover */
.hg tbody tr:hover .hg-num { box-shadow: inset 0 0 0 999px rgba(45, 62, 115, 0.05); }

/* Actions */
.hg .hg-actions-col {
    width: 1%;
    min-width: 44px;
    padding-left: 8px;
}

.hg-icon-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--dash-border);
    background: #F0F0EC;
    color: #7A7A74;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.hg-icon-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hg-icon-btn:hover {
    background: #FBEDEC;
    border-color: #E3C4C2;
    color: var(--dash-hot);
}

/* Total bar */
.hg tfoot td { height: 36px; padding-top: 6px; }
.hg tfoot .hg-num { border: 0; }

.hg-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    background: #2A2D3E;
    color: #FFFFFF;
    font-weight: 500;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.hg-total-sub .hg-bar { background: #3A2A14; color: #FFD9A3; }

.hg-bar-start .hg-bar { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.hg-bar-end .hg-bar   { border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-right: 0; }

.hg-total-label {
    display: block;
    padding: 4px 9px;
    border-radius: 8px;
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #FFFFFF;
    background: #2A2D3E;
}

/* ---- Highlight grid (draw detail / tickets) ---- */
.hg thead .hg-drawn {
    color: #1F2A52;
    font-weight: 700;
    box-shadow: inset 0 -3px 0 #1F9D5B;
}

.hg thead .hg-sub.hg-drawn {
    color: #4A2802;
    box-shadow: inset 0 -3px 0 #22C3DD;
}

.hg-chip-guessed {
    background: #1F9D5B;
    color: #FFFFFF;
    box-shadow: 0 0 0 2px rgba(31, 157, 91, 0.25), 0 1px 2px rgba(26, 26, 24, 0.12);
}

.hg-chip-sub-guessed {
    background: #22C3DD;
    color: #06323A;
    box-shadow: 0 0 0 2px rgba(34, 195, 221, 0.3), 0 1px 2px rgba(26, 26, 24, 0.12);
}

.hg .hg-row-col { width: 1%; }

.hg-row-pill {
    display: block;
    min-width: 44px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    color: #1F2A52;
    background: linear-gradient(180deg, #D7DCEE 0%, #C3CAE4 100%);
    border: 1px solid #B3BBDA;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.hg .hg-hits-col {
    width: 1%;
    min-width: 64px;
    padding: 0 6px 0 10px;
    font-size: 12px;
}

.hg thead th:not(.hg-num) { border-bottom: 0; }
