:root {
    --k-bg: #f6f7f9;
    --k-surface: #ffffff;
    --k-ink: #111827;
    --k-muted: #4b5563;
    --k-border: #e5e7eb;
    --k-brand: #1e3a5f;
    --k-brand-ink: #ffffff;
    --k-accent: #2563eb;
    --k-physical: #c2410c;
    --k-emotional: #1d4ed8;
    --k-intellectual: #047857;
    --k-weak: #6b7280;
    --k-medium: #b45309;
    --k-strong: #047857;
    --k-radius: 10px;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html, body {
    background: var(--k-bg);
    color: var(--k-ink);
}

h1 {
    font-size: 1.6rem;
    font-weight: 650;
    margin: 0;
}

h1:focus {
    outline: none;
}

a {
    color: var(--k-accent);
}

/* ---------- Keret ---------- */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.6rem 1.5rem;
    background: var(--k-brand);
    color: var(--k-brand-ink);
    flex-wrap: wrap;
}

.brand {
    color: var(--k-brand-ink);
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.brand-sub {
    font-weight: 400;
    opacity: 0.75;
}

.app-nav {
    display: flex;
    gap: 0.25rem;
    flex: 1 1 auto;
    overflow-x: auto;
}

.app-nav .nav-item {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
}

.app-nav .nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.app-nav .nav-item.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: 600;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.user-name {
    font-size: 0.85rem;
    opacity: 0.85;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-main {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

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

.card-section, .result-section {
    background: var(--k-surface);
    border: 1px solid var(--k-border);
    border-radius: var(--k-radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 650;
    margin-bottom: 0.75rem;
}

.toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.selection-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    background: #eef2ff;
    border-radius: 8px;
    flex-wrap: wrap;
}

.table-responsive.is-loading {
    opacity: 0.6;
}

.people-table {
    background: var(--k-surface);
}

.col-check {
    width: 2.5rem;
}

.loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--k-muted);
    padding: 1rem 0;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    background: var(--k-surface);
    border: 1px dashed var(--k-border);
    border-radius: var(--k-radius);
}

.validation-message {
    color: #b91c1c;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.invalid {
    border-color: #b91c1c;
}

.group-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat {
    display: flex;
    flex-direction: column;
    background: var(--k-surface);
    border: 1px solid var(--k-border);
    border-radius: var(--k-radius);
    padding: 1rem 1.25rem;
    color: var(--k-ink);
    text-decoration: none;
}

.stat span {
    color: var(--k-muted);
    font-size: 0.9rem;
}

.stat strong {
    font-size: 1.6rem;
}

.simple-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.simple-list li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--k-border);
}

.simple-list li:last-child {
    border-bottom: 0;
}

/* ---------- Eredmény ---------- */
.contour-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.contour-card {
    border: 1px solid var(--k-border);
    border-top: 4px solid var(--k-muted);
    border-radius: 8px;
    padding: 0.9rem 1rem;
}

.contour-physical { border-top-color: var(--k-physical); }
.contour-emotional { border-top-color: var(--k-emotional); }
.contour-intellectual { border-top-color: var(--k-intellectual); }

.kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
    margin: 0.75rem 0 0;
}

.kv dt {
    color: var(--k-muted);
    font-weight: 400;
}

.kv dd {
    margin: 0;
    font-weight: 600;
}

.markers-line {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 1.05rem;
}

.strength {
    display: inline-block;
    min-width: 4.5rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    color: #fff;
}

.strength-weak { background: var(--k-weak); }
.strength-medium { background: var(--k-medium); }
.strength-strong { background: var(--k-strong); }

.energy-bar {
    display: inline-block;
    width: 90px;
    height: 6px;
    margin-left: 0.5rem;
    background: var(--k-border);
    border-radius: 3px;
    vertical-align: middle;
    overflow: hidden;
}

.energy-bar span {
    display: block;
    height: 100%;
    background: var(--k-accent);
}

.type-list {
    padding-left: 1.1rem;
}

.totals-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: var(--k-bg);
    border-radius: 8px;
}

.total span {
    color: var(--k-muted);
    font-size: 0.9rem;
}

.total strong {
    font-size: 1.2rem;
}

.total-strong {
    background: #e0e7ff;
}

.explanation {
    margin: 0.75rem 0 0;
    font-size: 0.92rem;
}

.explanation-pending {
    color: var(--k-muted);
    font-style: italic;
}

.disclaimer {
    font-size: 0.85rem;
    color: var(--k-muted);
    border-left: 3px solid var(--k-border);
    padding-left: 0.75rem;
    margin: 0.75rem 0;
}

.meta-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
    font-size: 0.9rem;
}

.meta-grid dt {
    color: var(--k-muted);
    font-weight: 400;
}

.meta-grid dd {
    margin: 0;
}

/* ---------- Bioritmus ---------- */
.bio-controls {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.bio-controls input[type=date] {
    width: auto;
}

.bio-chart {
    margin: 0.75rem 0 0;
}

.bio-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.bio-canvas {
    position: relative;
    width: 100%;
}

.bio-canvas svg {
    width: 100%;
    height: auto;
    display: block;
    touch-action: manipulation;
}

.bio-grid { stroke: #e5e7eb; stroke-width: 0.8; }
.bio-axis-zero { stroke: #6b7280; stroke-width: 1.2; }
.bio-tick { stroke: #6b7280; stroke-width: 0.8; }
.bio-frame { fill: none; stroke: #9ca3af; stroke-width: 0.8; }
.bio-label { font-size: 10px; fill: #374151; font-family: inherit; }
.bio-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.bio-selected { stroke: #111827; stroke-width: 1.2; stroke-dasharray: 3 3; }
.bio-hover { stroke: #9ca3af; stroke-width: 1; }
.bio-point { stroke: #fff; stroke-width: 1; }
.bio-hit { fill: transparent; cursor: pointer; }
.bio-hit:hover { fill: rgba(37, 99, 235, 0.06); }

.bio-tooltip {
    position: absolute;
    top: 0.5rem;
    transform: translateX(8px);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.45rem 0.6rem;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    white-space: nowrap;
    z-index: 5;
}

.bio-tooltip-left {
    transform: translateX(calc(-100% - 8px));
}

.bio-physical-text::before, .bio-emotional-text::before, .bio-intellectual-text::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 0.35rem;
}

.bio-physical-text::before { background: var(--k-physical); }
.bio-emotional-text::before { background: #93c5fd; }
.bio-intellectual-text::before { background: #6ee7b7; }

.bio-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
    font-size: 0.88rem;
}

.bio-legend li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.bio-summary {
    font-size: 0.92rem;
    margin: 0.25rem 0;
}

.bio-table summary {
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--k-accent);
}

.compare-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.compare-table .group-row th {
    background: var(--k-bg);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--k-muted);
}

/* ---------- Személyválasztó ---------- */
.person-picker .picked {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--k-border);
    border-radius: 6px;
    background: var(--k-bg);
}

.picker-results {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0;
    border: 1px solid var(--k-border);
    border-radius: 6px;
    max-height: 18rem;
    overflow-y: auto;
    background: var(--k-surface);
}

.picker-option {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    width: 100%;
    padding: 0.45rem 0.75rem;
    border: 0;
    background: none;
    text-align: left;
}

.picker-option:hover:not(:disabled) {
    background: #eef2ff;
}

/* ---------- Dialógus ---------- */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    z-index: 1040;
}

.dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(480px, calc(100vw - 2rem));
    background: var(--k-surface);
    border-radius: var(--k-radius);
    padding: 1.25rem;
    z-index: 1050;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

/* ---------- Önálló oldalak (login, hiba) ---------- */
.standalone {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--k-bg);
    margin: 0;
}

.standalone-card {
    width: min(420px, 100%);
    background: var(--k-surface);
    border: 1px solid var(--k-border);
    border-radius: var(--k-radius);
    padding: 2rem;
    font-family: var(--bs-body-font-family);
}

/* ---------- Circuit-újracsatlakozás ---------- */
.reconnect-modal {
    display: none;
}

.reconnect-modal.components-reconnect-show,
.reconnect-modal.components-reconnect-failed,
.reconnect-modal.components-reconnect-rejected {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.5);
}

.reconnect-card {
    background: var(--k-surface);
    border-radius: var(--k-radius);
    padding: 1.5rem;
    max-width: 440px;
    margin: 1rem;
}

.reconnect-card p {
    display: none;
    margin: 0;
}

.components-reconnect-show .reconnect-show-text,
.components-reconnect-failed .reconnect-failed-text,
.components-reconnect-rejected .reconnect-rejected-text {
    display: block;
}

#blazor-error-ui {
    display: none;
}

/* ---------- Reszponzív ---------- */
@media (max-width: 991.98px) {
    .contour-grid, .totals-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .compare-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .app-header {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    .app-main {
        padding: 1rem;
    }

    .user-name {
        display: none;
    }

    .contour-grid, .totals-grid {
        grid-template-columns: 1fr;
    }

    .card-section, .result-section {
        padding: 1rem;
    }
}

@media print {
    .app-header, .bio-controls, .btn, .bio-table {
        display: none !important;
    }

    .app-main {
        max-width: none;
        padding: 0;
    }
}
