/**
 * Tactic detail page: magazine board with the report content of the old hub.
 * All rules are scoped to .fmh-tactic-page so the theme keeps its own styles.
 */

.fmh-tactic-page {
    --fmh-panel-2: #f4f7fa;
    --fmh-panel-3: #e8edf3;
    --fmh-row-hover: #fffbea;
    --fmh-success: #166534;
    --fmh-success-soft: rgba(22, 101, 52, .10);
    --fmh-warning: #8a5a00;
    --fmh-warning-soft: rgba(217, 150, 0, .12);
    --fmh-danger: #b42318;
    --fmh-danger-soft: rgba(180, 35, 24, .08);
    --fmh-info: #0e6b8a;
    --fmh-info-soft: rgba(14, 107, 138, .09);
    padding-top: 24px;
    padding-bottom: 48px;
}

.fmh-detail-panel {
    overflow: hidden;
    border: 2px solid var(--fmh-ink);
    border-radius: 20px;
    background-color: var(--fmh-panel);
    background-image:
        linear-gradient(var(--fmh-grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--fmh-grid-line) 1px, transparent 1px);
    background-size: 22px 22px;
    box-shadow: 6px 6px 0 var(--fmh-pop);
}

.fmh-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, .8fr);
    align-items: start;
}

.fmh-detail-main {
    min-width: 0;
    padding: clamp(22px, 3.4vw, 44px);
}

.fmh-detail-side {
    min-width: 0;
    padding: clamp(22px, 2.8vw, 36px);
    border-left: 2px dashed var(--fmh-line-strong);
    background: color-mix(in srgb, var(--fmh-panel-2) 76%, transparent);
}

.fmh-tactic-header {
    border-bottom: 2px dashed var(--fmh-line-strong);
    padding-bottom: 22px;
    margin-bottom: 24px;
}

.design-shell .fmh-tactic-page .fmh-tactic-header h1 {
    max-width: none;
}

.design-shell .fmh-tactic-page .fmh-tactic-header h1,
.fmh-tactic-header h1 {
    max-width: none;
    margin: 16px 0 10px;
    font-size: clamp(2rem, 3.4vw, 3rem);
    line-height: 1.02;
    letter-spacing: -.03em;
}

.fmh-tactic-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fmh-tactic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--fmh-muted);
    font-size: .9rem;
}

/* Badges */
.fmh-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border: 1.5px solid var(--fmh-line-strong);
    border-radius: 999px;
    background: var(--fmh-panel);
    color: var(--fmh-muted);
    font-size: .74rem;
    font-weight: 800;
    white-space: nowrap;
}

.fmh-badge-brand {
    background: var(--fmh-brand);
    border-color: var(--fmh-brand);
    color: var(--fmh-brand-ink);
}

.fmh-badge-success {
    background: var(--fmh-success-soft);
    border-color: color-mix(in srgb, var(--fmh-success) 50%, var(--fmh-line));
    color: var(--fmh-success);
}

.fmh-badge-warning {
    background: var(--fmh-warning-soft);
    border-color: color-mix(in srgb, var(--fmh-warning) 50%, var(--fmh-line));
    color: var(--fmh-warning);
}

.fmh-badge-danger {
    background: var(--fmh-danger-soft);
    border-color: color-mix(in srgb, var(--fmh-danger) 50%, var(--fmh-line));
    color: var(--fmh-danger);
}

.fmh-prose {
    max-width: 75ch;
    color: var(--fmh-text);
    font-size: 1rem;
}

.fmh-prose p {
    margin: 0 0 12px;
}

.fmh-section {
    margin-top: 30px;
}

.fmh-section-head h2 {
    margin: 0;
}

.fmh-section-head p {
    margin: 8px 0 18px;
    color: var(--fmh-muted);
}

/* Cards */
.fmh-card {
    background: var(--fmh-panel);
    border: 2px solid var(--fmh-ink);
    border-radius: 14px;
    padding: 20px;
}

.fmh-card-flat {
    border-width: 1.5px;
    border-color: var(--fmh-line-strong);
}

.fmh-run-card {
    min-width: 0;
}

.fmh-run-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.design-shell .fmh-tactic-page .fmh-card-title,
.fmh-card-title {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
    background: none;
    box-shadow: none;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.25;
    -webkit-box-decoration-break: slice;
    box-decoration-break: slice;
}

.fmh-card-meta {
    margin-top: 8px;
    color: var(--fmh-muted);
    font-size: .82rem;
}

/* Stats */
.fmh-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.fmh-run-stats,
.fmh-stats-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
}

.fmh-stat-card {
    min-width: 0;
    padding: 14px 16px;
    border: 1.5px solid var(--fmh-line-strong);
    border-radius: 12px;
    background: var(--fmh-panel);
}

.fmh-stat-label {
    display: block;
    color: var(--fmh-faint);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.fmh-stat-value {
    display: block;
    margin-top: 4px;
    font-size: clamp(1.25rem, 2.1vw, 1.8rem);
    font-weight: 800;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.fmh-stat-brand {
    color: var(--fmh-brand);
}

.fmh-stat-sub {
    color: var(--fmh-muted);
    font-size: .78rem;
}

/* W/D/L */
.fmh-wdl-block {
    margin-top: 16px;
}

.fmh-wdl {
    display: block;
    width: 100%;
    height: 12px;
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--fmh-panel-3);
}

.fmh-wdl rect {
    height: 12px;
}

.fmh-wdl-w { fill: var(--fmh-success); }
.fmh-wdl-d { fill: var(--fmh-warning); }
.fmh-wdl-l { fill: var(--fmh-danger); }

.fmh-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    color: var(--fmh-muted);
    font-size: .78rem;
}

.fmh-legend i {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 5px;
    border-radius: 3px;
}

.fmh-legend .fmh-w { background: var(--fmh-success); }
.fmh-legend .fmh-d { background: var(--fmh-warning); }
.fmh-legend .fmh-l { background: var(--fmh-danger); }

/* Assessment */
.fmh-assessment {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px dashed var(--fmh-line);
}

/* Tables */
.fmh-tactic-page h5 {
    margin: 18px 0 0;
    color: var(--fmh-muted);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.fmh-table-wrap {
    margin-top: 8px;
    overflow-x: auto;
    border: 1.5px solid var(--fmh-line-strong);
    border-radius: 14px;
    background: var(--fmh-panel);
}

table.fmh-data {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
}

table.fmh-data th,
table.fmh-data td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--fmh-line);
    text-align: right;
    vertical-align: top;
    white-space: nowrap;
}

table.fmh-data th:first-child,
table.fmh-data td:first-child {
    text-align: left;
}

table.fmh-data th {
    background: var(--fmh-panel-2);
    color: var(--fmh-muted);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

table.fmh-data tbody tr:hover {
    background: var(--fmh-row-hover);
}

table.fmh-data tr:last-child td {
    border-bottom: 0;
}

table.fmh-data tr.is-best td {
    background: var(--fmh-success-soft);
}

table.fmh-data tr.is-best td:last-child {
    color: var(--fmh-success);
    font-weight: 700;
}

table.fmh-data tr.is-worst td {
    background: var(--fmh-danger-soft);
}

table.fmh-data tr.is-worst td:last-child {
    color: var(--fmh-danger);
    font-weight: 700;
}

table.fmh-data tr.is-neutral-high td,
table.fmh-data tr.is-neutral-low td {
    background: var(--fmh-info-soft);
}

.fmh-cell-label {
    display: block;
}

.fmh-cell-sub {
    display: block;
    color: var(--fmh-muted);
    font-size: .75rem;
}

/* Details */
.fmh-details {
    margin-top: 16px;
}

.fmh-details summary {
    color: var(--fmh-brand);
    font-size: .92rem;
    font-weight: 800;
    cursor: pointer;
}

.fmh-details summary:hover {
    text-decoration: underline;
}

.fmh-all-areas {
    margin-top: 12px;
}

.fmh-all-areas summary {
    display: inline-flex;
    list-style: none;
    cursor: pointer;
}

.fmh-all-areas summary::-webkit-details-marker {
    display: none;
}

.fmh-all-areas[open] summary {
    background: var(--fmh-brand-soft);
}

.fmh-all-areas .fmh-table-wrap {
    margin-top: 12px;
}

.fmh-all-areas table.fmh-data {
    font-size: .82rem;
}

.fmh-all-areas table.fmh-data th,
.fmh-all-areas table.fmh-data td {
    padding: 8px 10px;
    white-space: normal;
}

/* Recommendations */
.fmh-recommendations-block {
    margin-top: 16px;
}

.fmh-recommendation-list {
    display: grid;
    gap: 10px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.fmh-recommendation {
    padding: 10px 12px;
    border: 1px solid var(--fmh-line);
    border-left: 4px solid var(--fmh-line-strong);
    border-radius: 6px;
    background: var(--fmh-panel-2);
}

.fmh-recommendation.priority-p1 {
    border-left-color: var(--fmh-warning);
}

.fmh-recommendation.priority-p2 {
    border-left-color: var(--fmh-info);
}

.fmh-recommendation-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.fmh-recommendation-head strong {
    color: var(--fmh-text);
}

.fmh-priority {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--fmh-panel-3);
    color: var(--fmh-muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.fmh-recommendation.priority-p1 .fmh-priority {
    background: var(--fmh-warning-soft);
    color: var(--fmh-warning);
}

.fmh-recommendation.priority-p2 .fmh-priority {
    background: var(--fmh-info-soft);
    color: var(--fmh-info);
}

.fmh-recommendation p {
    margin: 4px 0 0;
}

/* Findings */
.fmh-findings {
    display: grid;
    gap: 8px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    color: var(--fmh-muted);
    font-size: .9rem;
}

.fmh-findings li {
    padding: 6px 8px;
    border-left: 3px solid color-mix(in srgb, var(--fmh-success) 55%, transparent);
    border-radius: 4px;
    background: var(--fmh-success-soft);
}

.fmh-findings li.insight-warning {
    border-left-color: color-mix(in srgb, var(--fmh-danger) 55%, transparent);
    background: var(--fmh-danger-soft);
}

.fmh-findings strong {
    margin-right: 4px;
    color: var(--fmh-success);
}

.fmh-findings li.insight-warning strong {
    color: var(--fmh-danger);
}

/* Sidebar */
.fmh-detail-side .fmh-side-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.fmh-detail-side .fmh-side-card + .fmh-side-card {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px dashed var(--fmh-line-strong);
}

.fmh-side-list {
    display: grid;
    margin-top: 12px;
}

.fmh-side-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--fmh-line-strong);
    font-size: .88rem;
}

.fmh-side-item:last-child {
    border-bottom: 0;
}

.fmh-side-item span {
    color: var(--fmh-muted);
}

.fmh-divider {
    margin: 20px 0;
    border: 0;
    border-top: 2px dashed var(--fmh-line);
}

.fmh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 2px solid var(--fmh-ink);
    border-radius: 10px;
    background: var(--fmh-panel);
    color: var(--fmh-text);
    box-shadow: 3px 3px 0 var(--fmh-pop);
    font-weight: 800;
    text-decoration: none;
}

.fmh-button-primary {
    background: var(--fmh-brand);
    border-color: var(--fmh-brand);
    color: var(--fmh-brand-ink);
}

.fmh-button-block {
    display: flex;
    width: 100%;
    margin-top: 12px;
}

.fmh-button:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--fmh-pop);
}

.fmh-side-pitches {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.fmh-side-pitches figure {
    margin: 0;
    padding: 8px;
    border: 1.5px solid var(--fmh-line-strong);
    border-radius: 10px;
    background: var(--fmh-panel);
    text-align: center;
}

.fmh-tactic-page .pitch-mini {
    background: var(--fmh-pitch-bg);
}

.fmh-tactic-page .pitch-mini-line {
    fill: none;
    stroke: var(--fmh-pitch-line);
    stroke-width: .7;
    opacity: .75;
}

.fmh-tactic-page .pitch-mini-goal {
    fill: none;
    stroke: var(--fmh-pitch-line);
    stroke-width: .6;
    opacity: .6;
}

.fmh-tactic-page .pitch-mini-dot {
    fill: var(--fmh-pitch-dot);
    stroke: var(--fmh-panel);
    stroke-width: .5;
}

.fmh-pitch-small .pitch-mini {
    display: block;
    width: 100%;
    height: auto;
    max-width: none;
    border: 1.5px solid var(--fmh-pitch-line);
    border-radius: 6px;
    background: var(--fmh-pitch-bg);
}

.fmh-side-pitches figcaption {
    margin-top: 5px;
    color: var(--fmh-muted);
    font-size: .62rem;
    font-weight: 700;
    line-height: 1.25;
}

.fmh-author-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.fmh-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1.5px solid var(--fmh-line-strong);
    border-radius: 50%;
    background: var(--fmh-brand-soft);
    color: var(--fmh-brand);
    font-weight: 800;
}

/* Utilities */
.fmh-muted { color: var(--fmh-muted); }
.fmh-small { font-size: .88rem; }
.fmh-tiny { font-size: .75rem; }
.fmh-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.fmh-mt-8 { margin-top: 8px; }
.fmh-mt-16 { margin-top: 16px; }
.fmh-spread { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.fmh-link-more { font-size: .92rem; font-weight: 800; }

@media (max-width: 960px) {
    .fmh-detail-grid {
        grid-template-columns: 1fr;
    }

    .fmh-detail-side {
        border-left: 0;
        border-top: 2px dashed var(--fmh-line-strong);
    }
}

@media (max-width: 700px) {
    .fmh-detail-main,
    .fmh-detail-side {
        padding: 20px 16px;
    }

    .fmh-tactic-header h1 {
        font-size: 2rem;
    }

    .fmh-run-stats,
    .fmh-stats-2 {
        grid-template-columns: 1fr;
    }

    .fmh-tactic-meta {
        font-size: .8rem;
    }
}

/* Tactic upload page */
.fmh-upload {
    display: grid;
    gap: 12px;
}

.fmh-upload h2 {
    margin: 0;
    font-size: 1.35rem;
}

.fmh-upload-gate {
    align-content: start;
}

.fmh-upload-form {
    display: grid;
    gap: 14px;
}

.fmh-upload-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.fmh-field {
    display: grid;
    gap: 6px;
    color: var(--fmh-text);
    font-size: .85rem;
    font-weight: 700;
}

.fmh-field input[type="text"],
.fmh-field input[type="file"],
.fmh-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--fmh-line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--fmh-text);
    font: inherit;
    font-weight: 400;
}

.fmh-field textarea {
    min-height: 120px;
    resize: vertical;
}

.fmh-field input:focus,
.fmh-field textarea:focus {
    border-color: var(--fmh-brand);
    outline: 3px solid var(--fmh-brand-soft);
}

.fmh-upload-error {
    padding: 11px 13px;
    border: 1.5px solid #b42318;
    border-radius: 8px;
    background: #fff5f5;
    color: #7a1f1f;
    font-size: .88rem;
}

@media (max-width: 700px) {
    .fmh-upload-row {
        grid-template-columns: 1fr;
    }
}

/* Keep button labels readable against the theme's global link colour. */
.design-shell .page .fmh-button {
    color: var(--fmh-text);
}

.design-shell .page .fmh-button-primary {
    color: var(--fmh-brand-ink);
}

/* Two-step upload */
.fmh-step-label {
    color: var(--fmh-muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.fmh-upload-details {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 2px dashed var(--fmh-line);
}

.fmh-upload-form.fmh-js:not(.is-ready) .fmh-upload-details {
    display: none;
}

.fmh-upload-form.is-ready [data-step="file"] {
    display: none;
}

.fmh-upload-inspect {
    padding: 10px 12px;
    border-left: 3px solid var(--fmh-line-strong);
    background: var(--fmh-panel-2);
    color: var(--fmh-muted);
    font-size: .8rem;
    line-height: 1.45;
}

.fmh-upload-inspect.is-ok {
    border-left-color: var(--fmh-success);
    background: var(--fmh-success-soft);
    color: var(--fmh-success);
}

.fmh-upload-inspect.is-warn {
    border-left-color: var(--fmh-warning);
    background: var(--fmh-warning-soft);
    color: var(--fmh-warning);
}

.fmh-upload-inspect.is-error {
    border-left-color: var(--fmh-danger);
    background: var(--fmh-danger-soft);
    color: var(--fmh-danger);
}

.fmh-file-summary {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border: 1.5px solid var(--fmh-line-strong);
    border-radius: 8px;
    background: var(--fmh-panel-2);
    font-size: .82rem;
}

.fmh-file-summary strong {
    overflow-wrap: anywhere;
}

.fmh-file-summary span {
    color: var(--fmh-muted);
    font-size: .74rem;
}

.fmh-file-summary:empty {
    display: none;
}

.fmh-upload-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.fmh-button-secondary {
    background: var(--fmh-panel);
    color: var(--fmh-text);
}

.fmh-upload .fmh-button:disabled {
    opacity: .6;
    cursor: wait;
}

/* Upload details and queue */
.fmh-field-help {
    color: var(--fmh-muted);
    font-size: .72rem;
    font-weight: 400;
}

.fmh-field-counter {
    color: var(--fmh-muted);
    font-size: .72rem;
    font-weight: 400;
    text-align: right;
}

.fmh-upload-notice {
    padding: 11px 13px;
    border: 1.5px solid var(--fmh-line-strong);
    border-radius: 8px;
    background: var(--fmh-panel-2);
    color: var(--fmh-muted);
    font-size: .8rem;
    line-height: 1.5;
}

.fmh-upload-notice strong {
    color: var(--fmh-text);
}

.fmh-queue {
    border: 1.5px solid var(--fmh-line-strong);
    border-radius: 14px;
    background: var(--fmh-panel);
    padding: 16px 18px;
}

.fmh-queue-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 2px dashed var(--fmh-line);
}

.fmh-queue-empty {
    padding: 28px 12px;
    text-align: center;
    color: var(--fmh-muted);
}

.fmh-queue-list {
    display: grid;
}

.fmh-queue-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--fmh-line);
}

.fmh-queue-item:last-child {
    border-bottom: 0;
}

.fmh-queue-position {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--fmh-brand-soft);
    color: var(--fmh-brand);
    font-size: .78rem;
    font-weight: 800;
}

.fmh-queue-main {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.fmh-queue-main a {
    color: var(--fmh-text);
    font-weight: 800;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.fmh-queue-main a:hover {
    color: var(--fmh-brand);
    text-decoration: underline;
}

.fmh-queue-meta {
    color: var(--fmh-muted);
    font-size: .74rem;
}

/* Upload confirmation and empty result state */
.fmh-detail-notice {
    margin: 0 0 18px;
    padding: 11px 14px;
    border: 1.5px solid color-mix(in srgb, var(--fmh-success) 50%, var(--fmh-line));
    border-radius: 10px;
    background: var(--fmh-success-soft);
    color: var(--fmh-success);
    font-size: .86rem;
    font-weight: 700;
}

.fmh-empty {
    display: grid;
    gap: 8px;
    justify-items: start;
    padding: 22px 20px;
    border: 1.5px solid var(--fmh-line-strong);
    border-radius: 12px;
    background: var(--fmh-panel-2);
    color: var(--fmh-muted);
}

.fmh-empty p {
    margin: 0;
}

.fmh-detail-notice-muted {
    border-color: var(--fmh-line-strong);
    background: var(--fmh-panel-2);
    color: var(--fmh-muted);
}

.fmh-cancel-queue {
    margin-top: 12px;
}

.fmh-cancel-queue .fmh-button {
    width: 100%;
    color: var(--fmh-danger);
    border-color: var(--fmh-danger);
}
