* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f7f6f3;
    color: #1f2937;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ===== Landing page ===== */
.landing { max-width: 1000px; margin: 0 auto; padding: 5rem 2rem 3rem; }
.hero { text-align: center; margin-bottom: 4rem; }
.logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    color: #6b7280;
}
.logo { font-weight: 600; letter-spacing: -0.01em; }
.logo-tdh { color: #0066b3; }
.logo-tutator { color: #1f2937; }
.logo-sep { color: #d1d5db; font-size: 1.5rem; line-height: 1; }
.logo-img-tutator { height: 44px; width: auto; display: block; }

.landing-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 0.875rem;
}
.landing-footer p { margin: 0; }
.powered-by-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.powered-by-footer:hover { color: #535353; }
.powered-by-footer img { height: 24px; width: auto; display: block; }
.hero h1 {
    font-size: 2.75rem;
    margin: 0 0 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
}
.lede {
    font-size: 1.0625rem;
    color: #4b5563;
    max-width: 640px;
    margin: 0 auto;
}
.lede em { color: #0066b3; font-style: normal; font-weight: 600; }

.tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}
.tool-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.75rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.tool-card:hover:not(.disabled) {
    border-color: #0066b3;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -8px rgba(0, 102, 179, 0.15);
}
.tool-card.disabled { opacity: 0.55; cursor: not-allowed; }
.tool-card h2 {
    margin: 0;
    font-size: 1.3125rem;
    font-weight: 600;
    color: #0f172a;
}
.tool-card p {
    margin: 0;
    color: #4b5563;
    font-size: 0.9375rem;
    flex: 1;
}
.tool-status {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
}
.status-live { background: #d1fae5; color: #065f46; }
.status-planned { background: #f3f4f6; color: #6b7280; }

.stats {
    margin: 2rem 0 1rem;
    padding: 1.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-align: center;
}
.stats h3 {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    font-weight: 600;
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}
.stat-num {
    font-size: 2rem;
    font-weight: 700;
    color: #0066b3;
    letter-spacing: -0.02em;
    line-height: 1;
}
.stat-label {
    font-size: 0.8125rem;
    color: #6b7280;
}
.stat-meta {
    margin: 0;
    font-size: 0.8125rem;
    color: #9ca3af;
}
.stats-loading {
    color: #9ca3af;
    margin: 0;
    font-size: 0.875rem;
}

/* Item action buttons (Deep dive on feed) */
.item-actions {
    margin: 0.5rem 0 0.75rem;
    display: flex;
    gap: 0.5rem;
}
.deepdive-btn {
    display: inline-block;
    padding: 0.4rem 0.875rem;
    border: 1px solid #0066b3;
    background: white;
    color: #0066b3;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.deepdive-btn:hover:not(:disabled) {
    background: #0066b3;
    color: white;
}
.deepdive-btn:disabled { opacity: 0.7; cursor: progress; }
.deepdive-btn.existing { background: #eff6ff; }
.deepdive-btn.analyzing {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
    position: relative;
    padding-right: 2.25rem;
}
.deepdive-btn.analyzing::after {
    content: "";
    position: absolute;
    right: 0.65rem;
    top: 50%;
    width: 0.85rem;
    height: 0.85rem;
    margin-top: -0.425rem;
    border: 2px solid #f59e0b;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.deepdive-btn.failed {
    background: #fee2e2;
    color: #991b1b;
    border-color: #ef4444;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Map page */
.map-wrap {
    position: relative;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.map-controls {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 5;
}
.map-controls button {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.map-controls button:hover { background: #f9fafb; color: #0066b3; border-color: #0066b3; }
#world-map {
    width: 100%;
    height: auto;
    display: block;
    background: #f9fafb;
    border-radius: 6px;
}
#world-map path.country {
    stroke: #ffffff;
    stroke-width: 0.5;
    cursor: pointer;
    transition: opacity 0.15s, stroke-width 0.15s;
}
#world-map path.country:hover {
    stroke: #0066b3;
    stroke-width: 1.5;
    opacity: 0.92;
}
.map-tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 0.625rem 0.875rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    pointer-events: none;
    z-index: 1000;
    max-width: 280px;
    box-shadow: 0 6px 16px -4px rgba(0,0,0,0.3);
}
.map-tooltip strong { color: #fde68a; }
.map-tooltip .muted { color: #94a3b8; }
.map-legend {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8125rem;
    color: #6b7280;
    flex-wrap: wrap;
}
.legend-label {
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
}
.legend-swatch {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.legend-box {
    width: 1.25rem;
    height: 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
    display: inline-block;
}
.country-row { cursor: pointer; transition: background 0.1s; }
.country-row:hover { background: #f9fafb; }

/* Clusters page */
.cluster-meta {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0 0 1.5rem;
}
.cluster-meta code {
    background: #f3f4f6;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.875em;
}
.cluster {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}
.cluster-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.cluster h2 {
    margin: 0;
    font-size: 1.0625rem;
    color: #0f172a;
    font-weight: 600;
    line-height: 1.4;
}
.cluster-count {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0066b3;
    background: #eff6ff;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    white-space: nowrap;
}
.cluster-summary {
    color: #4b5563;
    margin: 0 0 0.75rem;
}
.cluster-members {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.cluster-member {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding-top: 0.75rem;
    border-top: 1px dashed #f3f4f6;
}
.cluster-member:first-child { border-top: none; padding-top: 0; }
.cluster-member a { color: #0f172a; text-decoration: none; }
.cluster-member a:hover { color: #0066b3; }
.cluster-member-summary {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0.25rem 0 0;
}

/* Bulletin page */
.bulletin-wrap {
    max-width: 820px;
    margin: 0 auto;
    padding: 2rem;
}
.bulletin-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}
.bulletin-meta {
    margin-top: 0.75rem;
    color: #6b7280;
    font-size: 0.8125rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.bulletin-meta code {
    background: #f3f4f6;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
}
.bulletin-body { line-height: 1.65; color: #1f2937; }
.bulletin-body h1 {
    margin: 0 0 1.5rem;
    font-size: 2rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #0f172a;
}
.bulletin-body h2 {
    margin: 2.5rem 0 0.75rem;
    font-size: 1.375rem;
    color: #0f172a;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
}
.bulletin-body h3 {
    margin: 1.75rem 0 0.5rem;
    font-size: 1.0625rem;
    color: #1f2937;
}
.bulletin-body p { margin: 0 0 1rem; }
.bulletin-body ul, .bulletin-body ol { margin: 0 0 1rem 0; padding-left: 1.5rem; }
.bulletin-body li { margin-bottom: 0.375rem; }
.bulletin-body a { color: #0066b3; text-decoration: none; border-bottom: 1px solid #b3d9f2; }
.bulletin-body a:hover { background: #eff6ff; }
.bulletin-body code {
    background: #f3f4f6;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.875em;
}
.bulletin-body strong { font-weight: 600; }
.bulletin-body .country {
    background: #eff6ff;
    color: #0c4a6e;
    font-weight: 600;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    border: 1px solid #dbeafe;
}
.bulletin-body a .country {
    background: transparent;
    border-color: transparent;
    color: inherit;
}
.bulletin-body blockquote {
    border-left: 3px solid #d1d5db;
    margin: 1rem 0;
    padding: 0.25rem 1rem;
    color: #4b5563;
    font-style: italic;
}

/* Sources page extras */
.source-row { cursor: pointer; transition: background 0.1s; }
.source-row:hover { background: #f9fafb; }
.src-url {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.125rem;
    word-break: break-all;
}
.badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
}
.badge-on { background: #d1fae5; color: #065f46; }
.badge-off { background: #f3f4f6; color: #9ca3af; }
.badge-active {
    background: #fef3c7;
    color: #92400e;
    margin-left: 0.5rem;
}
tr.connection-active {
    background: #fffbeb;
}
tr.connection-active td:first-child {
    box-shadow: inset 3px 0 0 #f59e0b;
}
.hint {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin: 0.5rem 0 0;
}

/* Demo landing — explainer sections */
.demo-banner {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    margin-bottom: 2.5rem;
    display: flex;
    gap: 1.25rem;
    align-items: center;
    flex-wrap: wrap;
}
.demo-pill {
    display: inline-block;
    background: #f59e0b;
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    white-space: nowrap;
}
.demo-banner p {
    margin: 0;
    color: #78350f;
    font-size: 0.9375rem;
    flex: 1;
    min-width: 280px;
}
.explainer {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
}
.explainer h2 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    color: #0f172a;
    letter-spacing: -0.01em;
}
.explainer p {
    margin: 0 0 1rem;
    color: #374151;
}
.explainer p.aside {
    color: #6b7280;
    font-size: 0.9375rem;
    border-top: 1px solid #f3f4f6;
    padding-top: 1rem;
    margin-top: 0.5rem;
}
.pipeline {
    counter-reset: pipeline;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}
.pipeline li {
    position: relative;
    padding: 0.75rem 0 0.75rem 3rem;
    border-bottom: 1px dashed #f3f4f6;
    color: #374151;
}
.pipeline li:last-child { border-bottom: none; }
.pipeline li::before {
    counter-increment: pipeline;
    content: counter(pipeline);
    position: absolute;
    left: 0;
    top: 0.65rem;
    width: 1.875rem;
    height: 1.875rem;
    background: #0066b3;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}
.pipeline strong { color: #0f172a; }
.pipeline em { font-style: normal; color: #0066b3; font-weight: 500; }
.next-tag {
    display: inline-block;
    background: #ecfdf5;
    color: #047857;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.375rem;
    vertical-align: middle;
}
.howto, .caveats {
    list-style: none;
    padding: 0;
    margin: 0;
}
.howto li {
    padding: 0.625rem 0 0.625rem 1.5rem;
    border-bottom: 1px dashed #f3f4f6;
    position: relative;
}
.howto li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #0066b3;
    font-weight: 700;
}
.howto li:last-child { border-bottom: none; }
.howto a { color: #0066b3; text-decoration: none; }
.howto a:hover { text-decoration: underline; }
.caveats li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    color: #6b7280;
    font-size: 0.9375rem;
    position: relative;
}
.caveats li::before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    color: #9ca3af;
}

/* Breadcrumb above tabs — "← All tools" escape route to root */
.breadcrumb {
    background: #f9fafb;
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.8125rem;
}
.breadcrumb a {
    color: #6b7280;
    text-decoration: none;
}
.breadcrumb a:hover { color: #0066b3; }

/* Tab nav — sticky horizontal tabs across the top */
.tabnav {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}
.tabnav .powered-by {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0 0.5rem 1rem;
    border-bottom: none;
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}
.tabnav .powered-by:hover { color: #535353; }
.tabnav .powered-by img { height: 22px; width: auto; display: block; }
.tabnav a {
    padding: 1rem 1.125rem 0.875rem;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.tabnav a:hover {
    color: #0066b3;
}
.tabnav a.active {
    color: #0066b3;
    border-bottom-color: #0066b3;
}
/* Pull the landing hero away from the top so tabs don't overlap */
.landing { padding-top: 2.5rem; }

/* Costs page */
.cost-summary {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.75rem;
    margin: 1.5rem 0;
}
.cost-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.5rem;
}
.cost-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}
.cost-num {
    font-size: 2rem;
    font-weight: 700;
    color: #0066b3;
    letter-spacing: -0.02em;
    line-height: 1;
}
.cost-label {
    font-size: 0.8125rem;
    color: #6b7280;
    text-align: center;
}
.cost-block {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}
.cost-block h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    font-weight: 600;
}
.cost-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.cost-table th, .cost-table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}
.cost-table th {
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}
.cost-table tr:last-child td { border-bottom: none; }
/* Sortable headers + resize handles */
.cost-table.sortable th {
    cursor: pointer;
    user-select: none;
    position: relative;
}
.cost-table.sortable th:hover { color: #0066b3; }
.cost-table .sort-ind {
    display: inline-block;
    min-width: 0.875rem;
    color: #0066b3;
    font-weight: 700;
}
.cost-table .col-resize {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    background: transparent;
}
.cost-table .col-resize:hover { background: #e5e7eb; }
.cost-table.resizable th { padding-right: 1.25rem; }
.bulletin-row { cursor: pointer; }
.bulletin-row:hover { background: #f9fafb; }
.cost-table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: #0066b3; }
.cost-table td.empty { text-align: center; padding: 1.5rem; color: #9ca3af; }
.controls select { padding: 0.375rem 0.625rem; border: 1px solid #d1d5db; border-radius: 4px; font: inherit; }

footer {
    text-align: center;
    color: #9ca3af;
    font-size: 0.8125rem;
    margin-top: 2rem;
}

/* ===== Intel page ===== */
.intel { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.intel header { margin-bottom: 1.5rem; }
.back {
    display: inline-block;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}
.back:hover { color: #0066b3; }
.intel h1 {
    margin: 0.25rem 0 0.25rem;
    font-size: 1.875rem;
    color: #0f172a;
}
.subtitle { margin: 0 0 1.5rem; color: #6b7280; }

.controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 1rem 1.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
}
.controls input[type="text"] {
    padding: 0.375rem 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
}
.controls input[type="range"] { width: 140px; }
.controls button {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    font-size: 0.875rem;
}
.controls button:hover:not(:disabled) { background: #f3f4f6; border-color: #9ca3af; }
.controls button:disabled { opacity: 0.5; cursor: not-allowed; }
#status { color: #6b7280; font-size: 0.8125rem; }

#feed { margin-top: 1.5rem; }

.item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}
.item-head {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}
.score {
    display: inline-block;
    min-width: 2.75rem;
    text-align: center;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}
.score.high { background: #d1fae5; color: #065f46; }
.score.mid { background: #fef3c7; color: #92400e; }
.score.low { background: #f3f4f6; color: #6b7280; }
.item h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
    line-height: 1.4;
}
.item h3 a { color: #0f172a; text-decoration: none; }
.item h3 a:hover { color: #0066b3; }

.meta {
    color: #6b7280;
    font-size: 0.8125rem;
    margin: 0.25rem 0 0.75rem;
}
.summary { margin: 0 0 0.75rem; color: #374151; }

details {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f3f4f6;
}
details summary {
    cursor: pointer;
    color: #6b7280;
    font-size: 0.875rem;
    user-select: none;
}
details summary:hover { color: #0066b3; }
.reasoning {
    color: #4b5563;
    font-size: 0.875rem;
    margin: 0.5rem 0;
}
.tags {
    font-size: 0.8125rem;
    color: #4b5563;
    margin: 0.375rem 0;
}
.tags strong { color: #374151; }
.empty {
    color: #6b7280;
    text-align: center;
    padding: 3rem 1rem;
    font-size: 0.9375rem;
}

/* ===== Country profiles list ===== */
.countries-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.9375rem;
    margin-top: 1rem;
}
.countries-table thead th {
    background: #f9fafb;
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-weight: 600;
    color: #374151;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid #e5e7eb;
}
.countries-table thead th.num { text-align: right; }
.countries-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #f3f4f6; }
.countries-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.countries-table tbody tr { cursor: pointer; }
.countries-table tbody tr:hover { background: #fafaf8; }

/* ===== Country profile — indicator panel ===== */
.metrics-panel {
    background: #fdfdfb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1rem 1.25rem 1.25rem;
    margin: 0 0 2rem;
}
.metrics-disclaimer {
    color: #6b7280;
    font-size: 0.8125rem;
    margin: 0 0 1rem;
    line-height: 1.45;
    font-style: italic;
}
.metrics-tdh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}
.metrics-tdh-table thead th {
    background: #f9fafb;
    text-align: left;
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #374151;
    font-weight: 600;
}
.metrics-tdh-table thead th.num { text-align: right; }
.metrics-tdh-table tbody td {
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.metrics-tdh-table tbody td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #111827;
}
.metrics-tdh-table tbody tr.metric-empty-row { opacity: 0.5; }
.metrics-tdh-table tbody td.source-tag {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.metrics-tdh-table tbody td.trend { width: 96px; }
.metrics-tdh-table tbody td.delta {
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    width: 80px;
}
.delta-up   { color: #b45309; }   /* upward, neutral-coloured — interpret in row context */
.delta-down { color: #047857; }
.delta-flat { color: #6b7280; }
.delta-empty { color: #9ca3af; font-style: italic; }
.sparkline { display: inline-block; vertical-align: middle; }

/* ===== Compare page ===== */
.compare-wrap { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.compare-picker {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.compare-picker label { display: flex; flex-direction: column; font-size: 0.8125rem; color: #4b5563; }
.compare-picker select {
    margin-top: 0.25rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.9375rem;
    min-width: 240px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
}
.compare-picker button {
    padding: 0.5rem 1rem;
    background: #0066b3;
    color: white;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9375rem;
}
.compare-picker button:hover { background: #004e88; }
.compare-indicator-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.9375rem;
}
.compare-indicator-table thead th {
    background: #f9fafb;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: bottom;
}
.compare-indicator-table thead th.indicator-col {
    color: #4b5563;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 600;
}
.compare-indicator-table thead th.country-col {
    text-align: right;
    font-size: 1rem;
    color: #0f172a;
}
.compare-indicator-table thead th.country-col a {
    color: #0066b3;
    text-decoration: none;
    font-weight: 600;
}
.compare-indicator-table thead th.country-col .iso {
    display: block; color: #9ca3af; font-weight: 400;
    font-size: 0.75rem; letter-spacing: 0.04em;
}
.compare-indicator-table thead th.country-col .region {
    display: block; color: #6b7280; font-weight: 400; font-size: 0.75rem;
}
.compare-indicator-table th.indicator-col {
    text-align: left; color: #374151; font-weight: 500;
    padding: 0.5rem 0.875rem; width: 50%;
}
.compare-indicator-table td.country-col {
    text-align: right; padding: 0.5rem 0.875rem;
    font-variant-numeric: tabular-nums; color: #111827;
    width: 25%; border-bottom: 1px solid #f3f4f6;
}
.compare-indicator-table tr:hover td.country-col,
.compare-indicator-table tr:hover th.indicator-col { background: #fafaf8; }
.cell-better { background: #ecfdf5; color: #065f46; font-weight: 600; }
.cell-worse  { background: #fef3c7; color: #92400e; font-weight: 600; }
.cell-equal  { background: #f3f4f6; color: #4b5563; }
.compare-indicator-table tr:hover td.cell-better { background: #d1fae5; }
.compare-indicator-table tr:hover td.cell-worse  { background: #fde68a; }
.compare-legend {
    margin-top: 1rem; font-size: 0.8125rem; color: #6b7280;
    display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem;
}
.compare-legend .legend-swatch {
    display: inline-block; width: 0.875rem; height: 0.875rem;
    border-radius: 3px; margin-right: 0.25rem; vertical-align: -2px;
    border: 1px solid #e5e7eb;
}

/* ===== Rankings page ===== */
.rankings-wrap { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.rankings-controls {
    display: flex; gap: 0.75rem; align-items: flex-end;
    flex-wrap: wrap; margin-bottom: 1.25rem;
}
.rankings-controls label { display: flex; flex-direction: column; font-size: 0.8125rem; color: #4b5563; }
.rankings-controls select {
    margin-top: 0.25rem; padding: 0.375rem 0.5rem;
    font-size: 0.9375rem; border: 1px solid #d1d5db;
    border-radius: 4px; background: white; min-width: 280px;
}
.rankings-controls button {
    padding: 0.5rem 1rem; background: #0066b3; color: white; border: 0;
    border-radius: 4px; cursor: pointer; font-size: 0.9375rem;
}
.rankings-table {
    width: 100%; border-collapse: collapse; background: white;
    border: 1px solid #e5e7eb; border-radius: 6px; overflow: hidden;
    font-size: 0.9375rem;
}
.rankings-table th, .rankings-table td {
    padding: 0.5rem 0.75rem; border-bottom: 1px solid #f3f4f6;
}
.rankings-table thead th {
    background: #f9fafb; text-align: left; font-weight: 600;
    color: #374151; font-size: 0.8125rem;
    text-transform: uppercase; letter-spacing: 0.02em;
}
.rankings-table td.rank-num,
.rankings-table th.rank-num { text-align: right; width: 4rem; }
.rankings-table td.metric-val,
.rankings-table th.metric-val {
    text-align: right; font-variant-numeric: tabular-nums; width: 8rem;
}
.rankings-table td.no-val { color: #9ca3af; font-style: italic; }
.rankings-table tbody tr:hover { background: #fafaf8; cursor: pointer; }

/* ===== Auth (magic-link sign-in) ===== */
.auth-page { max-width: 560px; }
.auth-form-wrap {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}
.auth-form { display: flex; flex-direction: column; gap: 0.75rem; }
.auth-form label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}
.auth-form input[type="email"] {
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    color: #1f2937;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-form input[type="email"]:focus {
    outline: none;
    border-color: #0066b3;
    box-shadow: 0 0 0 3px rgba(0, 102, 179, 0.15);
}
.auth-btn {
    padding: 0.75rem 1rem;
    background: #0066b3;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.15s;
}
.auth-btn:hover { background: #00568f; }
.auth-aside {
    margin-top: 1.25rem;
    font-size: 0.8125rem;
    color: #6b7280;
    border-top: 1px solid #f3f4f6;
    padding-top: 1rem;
}
.auth-aside a { color: #0066b3; }
.auth-error {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Floating session widget — top-right of every page */
.auth-widget {
    position: fixed;
    bottom: 0.75rem;
    left: 0.875rem;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 0.25rem 0.25rem 0.25rem 0.875rem;
    font-size: 0.8125rem;
    box-shadow: 0 2px 6px -2px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(6px);
    max-width: 90vw;
}
.auth-widget-email {
    color: #374151;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 16rem;
}
.auth-widget-logout-form { margin: 0; }
.auth-widget-logout {
    background: #f3f4f6;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.auth-widget-logout:hover { background: #0066b3; color: #fff; border-color: #0066b3; }

/* ===== Rotating globe (countries page) ===== */
.globe-section {
    margin: 1rem 0 1.5rem;
    background: #0b1220;
    border: 1px solid #1f2937;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}
.globe-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.625rem 1rem;
    background: linear-gradient(180deg, rgba(11,18,32,0.85), rgba(11,18,32,0));
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 5;
    color: #e5e7eb;
    font-size: 0.8125rem;
}
.globe-controls label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.globe-controls select {
    background: rgba(255,255,255,0.08);
    color: #e5e7eb;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}
.globe-controls select option { background: #0b1220; color: #e5e7eb; }
.globe-controls .checkbox-label { cursor: pointer; }
.globe-controls input[type="checkbox"] { accent-color: #3b82f6; }
#globe-host {
    width: 100%;
    min-height: 360px;
    cursor: grab;
}
#globe-host:active { cursor: grabbing; }
.globe-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    z-index: 10;
    max-width: 240px;
    box-shadow: 0 6px 16px -4px rgba(0,0,0,0.4);
    border: 1px solid rgba(59,130,246,0.4);
}

/* ---------------------------------------------------------------------
 * Item feedback widget — thumbs-up / thumbs-down + optional note,
 * inline on each item card under the deep-dive button row.
 * --------------------------------------------------------------------- */
.feedback-widget {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-left: 0.5rem;
}
.feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid #d1d5db;
    background: white;
    color: #4b5563;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.feedback-btn:hover:not(.voted) {
    background: #f3f4f6;
    color: #111827;
    border-color: #9ca3af;
}
.feedback-icon {
    font-size: 0.95rem;
    line-height: 1;
}
.feedback-count {
    font-variant-numeric: tabular-nums;
    min-width: 0.75rem;
    text-align: center;
}
.feedback-up.voted {
    background: #ecfdf5;
    color: #065f46;
    border-color: #10b981;
}
.feedback-down.voted {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}
.feedback-note {
    flex: 1 1 12rem;
    min-width: 8rem;
    max-width: 24rem;
    padding: 0.3rem 0.55rem;
    font: inherit;
    font-size: 0.8125rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #1f2937;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.feedback-note:focus {
    outline: none;
    border-color: #0066b3;
    box-shadow: 0 0 0 2px rgba(0, 102, 179, 0.12);
}
.feedback-status {
    font-size: 0.75rem;
    color: #6b7280;
    font-style: italic;
}
.feedback-status.feedback-error {
    color: #991b1b;
    font-style: normal;
    font-weight: 600;
}

/* ============================================================
   In-app AI research assistant — floating launcher + slide panel
   ============================================================ */

.chat-launcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0066b3;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    z-index: 9990;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.chat-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    background: #00528f;
}
.chat-launcher:focus-visible {
    outline: 3px solid rgba(0, 102, 179, 0.4);
    outline-offset: 3px;
}

.chat-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.10);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 9999;
    font-family: inherit;
}
.chat-panel.open {
    transform: translateX(0);
}

.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: #0066b3;
    color: white;
    font-weight: 600;
}
.chat-panel-title {
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}
.chat-panel-close {
    background: transparent;
    color: white;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.3rem;
    border-radius: 4px;
}
.chat-panel-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.chat-panel-thread {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.85rem 1rem;
    background: #f9fafb;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #111827;
}

.chat-msg {
    margin: 0 0 0.7rem 0;
    padding: 0.55rem 0.8rem;
    border-radius: 10px;
    max-width: 88%;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.chat-msg p { margin: 0 0 0.5rem 0; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul {
    margin: 0.25rem 0 0.5rem 1.1rem;
    padding: 0;
}
.chat-msg ul li { margin-bottom: 0.2rem; }
.chat-msg a {
    color: #0066b3;
    text-decoration: underline;
}
.chat-msg code {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 3px;
    padding: 0.05rem 0.3rem;
    font-size: 0.85em;
}

.chat-msg-user {
    background: #e0efff;
    color: #0a3a66;
    margin-left: auto;
    text-align: left;
    border-bottom-right-radius: 2px;
}
.chat-msg-assistant {
    background: transparent;
    color: #1f2937;
    padding-left: 0;
    padding-right: 0;
}
.chat-msg-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.chat-tool {
    margin: 0 0 0.7rem 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #4b5563;
}
.chat-tool > summary {
    cursor: pointer;
    padding: 0.4rem 0.65rem;
    list-style: none;
    user-select: none;
}
.chat-tool > summary::-webkit-details-marker { display: none; }
.chat-tool-icon { margin-right: 0.3rem; }
.chat-tool > summary code {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    padding: 0.05rem 0.3rem;
    font-size: 0.85em;
    color: #1f2937;
}
.chat-tool-body {
    padding: 0 0.65rem 0.55rem 0.65rem;
}
.chat-tool-label {
    margin-top: 0.4rem;
    font-weight: 600;
    color: #6b7280;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.chat-tool-pre {
    background: #f3f4f6;
    border-radius: 6px;
    padding: 0.45rem 0.55rem;
    margin: 0.2rem 0 0 0;
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    color: #1f2937;
    max-height: 200px;
}

.chat-tool-pending {
    font-size: 0.8rem;
    color: #6b7280;
    font-style: italic;
    margin: 0 0 0.55rem 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.chat-tool-pending code {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    padding: 0.05rem 0.3rem;
    font-style: normal;
    color: #1f2937;
}
.chat-spinner {
    display: inline-block;
    width: 11px;
    height: 11px;
    border: 2px solid #d1d5db;
    border-top-color: #0066b3;
    border-radius: 50%;
    animation: chat-spin 0.8s linear infinite;
}
@keyframes chat-spin {
    to { transform: rotate(360deg); }
}

.chat-panel-form {
    display: flex;
    gap: 0.45rem;
    padding: 0.65rem 0.75rem;
    border-top: 1px solid #e5e7eb;
    background: white;
}
.chat-panel-input {
    flex: 1 1 auto;
    resize: none;
    padding: 0.5rem 0.65rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #111827;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-panel-input:focus {
    outline: none;
    border-color: #0066b3;
    box-shadow: 0 0 0 3px rgba(0, 102, 179, 0.12);
}
.chat-panel-send {
    background: #0066b3;
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-panel-send:hover {
    background: #00528f;
}
.chat-panel-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-panel-footer {
    padding: 0.4rem 0.85rem 0.55rem 0.85rem;
    background: white;
    border-top: 1px solid #f3f4f6;
}
.chat-panel-cost {
    font-size: 0.72rem;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
    .chat-panel { width: 100vw; }
    .chat-launcher { bottom: 14px; right: 14px; width: 50px; height: 50px; }
}

/* ============================================================
   Live-progress activity panel — floating pill bottom-left
   ============================================================ */

.jobs-pill {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    color: #1f2937;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 0.45rem 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 9990;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.jobs-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.13);
}
.jobs-pill:focus-visible {
    outline: 3px solid rgba(0, 102, 179, 0.4);
    outline-offset: 2px;
}
.jobs-pill-label {
    color: #1f2937;
    letter-spacing: 0.01em;
}
.jobs-pill-elapsed {
    color: #6b7280;
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
}
.jobs-pill-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #9ca3af;
    flex-shrink: 0;
}
.jobs-pill-running .jobs-pill-dot {
    background: #0066b3;
    box-shadow: 0 0 0 0 rgba(0, 102, 179, 0.55);
    animation: jobs-pulse 1.4s infinite;
}
.jobs-pill-done {
    border-color: #10b981;
}
.jobs-pill-done .jobs-pill-dot { background: #10b981; }
.jobs-pill-error {
    border-color: #dc2626;
}
.jobs-pill-error .jobs-pill-dot { background: #dc2626; }

@keyframes jobs-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(0, 102, 179, 0.55); }
    70%  { box-shadow: 0 0 0 10px rgba(0, 102, 179, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 102, 179, 0); }
}

.jobs-panel {
    position: fixed;
    bottom: 70px;
    left: 20px;
    width: 420px;
    max-width: calc(100vw - 40px);
    max-height: 60vh;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.20s ease, opacity 0.20s ease;
    z-index: 9999;
    font-family: inherit;
    overflow: hidden;
}
.jobs-panel.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.jobs-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.9rem;
    background: #0066b3;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}
.jobs-panel-title {
    font-size: 0.9rem;
    letter-spacing: 0.01em;
}
.jobs-panel-header-actions {
    display: flex;
    gap: 0.25rem;
}
.jobs-panel-collapse,
.jobs-panel-close {
    background: transparent;
    color: white;
    border: none;
    cursor: pointer;
    padding: 0 0.45rem;
    border-radius: 4px;
    font-size: 1.1rem;
    line-height: 1;
}
.jobs-panel-collapse:hover,
.jobs-panel-close:hover {
    background: rgba(255, 255, 255, 0.15);
}
.jobs-panel-close { font-size: 1.4rem; }

.jobs-panel-summary {
    padding: 0.55rem 0.9rem 0.5rem 0.9rem;
    border-bottom: 1px solid #f3f4f6;
    background: #f9fafb;
    flex-shrink: 0;
}
.jobs-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.jobs-summary-state {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.18rem 0.55rem;
    border-radius: 3px;
}
.jobs-state-running { background: #dbeafe; color: #0066b3; }
.jobs-state-done    { background: #d1fae5; color: #065f46; }
.jobs-state-error   { background: #fee2e2; color: #991b1b; }

.jobs-summary-elapsed {
    font-size: 0.78rem;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}
.jobs-summary-progress {
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: #4b5563;
    min-height: 1.1rem;
}

.jobs-panel-log {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.5rem 0.7rem;
    background: white;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #1f2937;
}
.jobs-log-entry {
    display: grid;
    grid-template-columns: 70px 14px 1fr;
    gap: 0.35rem;
    padding: 0.1rem 0.1rem;
    border-radius: 3px;
}
.jobs-log-ts {
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
}
.jobs-log-icon {
    text-align: center;
}
.jobs-log-msg {
    word-break: break-word;
}
.jobs-log-msg strong {
    font-weight: 600;
    color: #111827;
}
.jobs-log-progress .jobs-log-icon { color: #0066b3; }
.jobs-log-done     .jobs-log-icon { color: #10b981; }
.jobs-log-done     .jobs-log-msg  { color: #064e3b; }
.jobs-log-error    .jobs-log-icon { color: #dc2626; }
.jobs-log-error    .jobs-log-msg  { color: #7f1d1d; }
.jobs-log-warn     .jobs-log-icon { color: #f59e0b; }
.jobs-log-warn     .jobs-log-msg  { color: #78350f; }
.jobs-log-queued   .jobs-log-icon { color: #9ca3af; }

.jobs-panel-footer {
    padding: 0.4rem 0.9rem 0.55rem 0.9rem;
    background: white;
    border-top: 1px solid #f3f4f6;
    flex-shrink: 0;
}
.jobs-panel-cost {
    font-size: 0.74rem;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
    .jobs-panel { width: calc(100vw - 24px); left: 12px; }
    .jobs-pill { bottom: 14px; left: 14px; }
}

.btn-spinner {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(0, 0, 0, 0.18);
    border-top-color: #0066b3;
    border-radius: 50%;
    animation: chat-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 0.3rem;
}


/* ===== Country priorities tab — Tdh-Lausanne operational footprint ===== */
.priority-pill {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    vertical-align: middle;
    margin-right: 0.4rem;
    line-height: 1.4;
    white-space: nowrap;
}
.priority-pill.active-programme { background: #10b981; }
.priority-pill.strategic-watch  { background: #0066b3; }
.priority-pill.federation-interest { background: #f59e0b; }
.priority-pill.out-of-scope { background: #9ca3af; }
/* `standard` deliberately renders no pill — clean default. */

/* Country-name pill used in bulletin bodies: the country name itself
   carries the tier colour (white text on a coloured background), in
   place of the small label pill the /priorities table uses. */
.country-pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    color: #fff;
    font-weight: 600;
    line-height: 1.45;
    white-space: nowrap;
}
.country-pill.active-programme { background: #10b981; }
.country-pill.strategic-watch  { background: #0066b3; }
.country-pill.federation-interest { background: #f59e0b; }
.country-pill.out-of-scope { background: #9ca3af; }

.priorities-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin: 1rem 0 1.25rem;
}
.prio-counters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.prio-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    color: #374151;
    transition: border-color 0.12s, background 0.12s;
}
.prio-chip:hover { border-color: #0066b3; }
.prio-chip.active {
    background: #eff6ff;
    border-color: #0066b3;
    color: #0066b3;
}
.prio-num {
    font-weight: 700;
    color: #0f172a;
}
.prio-chip.active .prio-num { color: #0066b3; }
.prio-cat { color: inherit; }

.prio-search input {
    padding: 0.4rem 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    min-width: 260px;
}
.prio-search input:focus {
    outline: none;
    border-color: #0066b3;
    box-shadow: 0 0 0 2px rgba(0, 102, 179, 0.15);
}

.priorities-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.9375rem;
    margin-top: 0.5rem;
}
.priorities-table thead th {
    background: #f9fafb;
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-weight: 600;
    color: #374151;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    user-select: none;
}
.priorities-table thead th:hover { color: #0066b3; }
.priorities-table thead th.num { text-align: right; }
.priorities-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.priorities-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #0066b3;
}
.priorities-table tbody tr:hover { background: #fafaf8; }
.prio-category-select {
    padding: 0.3rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    font-size: 0.875rem;
    background: white;
    color: #374151;
}
.prio-category-select:focus {
    outline: none;
    border-color: #0066b3;
    box-shadow: 0 0 0 2px rgba(0, 102, 179, 0.15);
}
.prio-saved {
    color: #047857;
    font-size: 0.8125rem;
    margin-left: 0.5rem;
    font-weight: 600;
}

/* ============================================================
   AI provider connections — /connections + per-section /costs
   ============================================================ */

/* Status pill for validation failures — reuse the badge geometry. */
.badge-error {
    display: inline-block;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
}

/* Action buttons on the /connections rows + add form. */
.btn {
    display: inline-block;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn-primary {
    background: #0066b3;
    color: white;
    border-color: #0066b3;
}
.btn-primary:hover {
    background: #00528f;
    border-color: #00528f;
}
.btn-secondary {
    background: white;
    color: #374151;
    border-color: #d1d5db;
}
.btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Add-connection form layout. */
.connection-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 720px;
}
.connection-form label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.8125rem;
    color: #374151;
    font-weight: 600;
}
.connection-form input,
.connection-form select {
    padding: 0.5rem 0.65rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    background: white;
    color: #111827;
}
.connection-form input:focus,
.connection-form select:focus {
    outline: none;
    border-color: #0066b3;
    box-shadow: 0 0 0 2px rgba(0, 102, 179, 0.15);
}
.connection-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
@media (max-width: 640px) {
    .connection-form .form-row { grid-template-columns: 1fr; }
}
.form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}
.form-status {
    font-size: 0.8125rem;
    color: #6b7280;
}
.form-status.feedback-error {
    color: #991b1b;
}

/* Masked-key rendering on the /connections list. */
.masked-key {
    background: #f3f4f6;
    color: #374151;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.8125rem;
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.row-status {
    margin-left: 0.5rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

/* Per-connection sections on the restructured /costs page — thicker
   top border + tinted background to make the breaks between
   connections obvious. */
.connection-section {
    border-top: 3px solid #0066b3;
    background: #f8fafc;
    padding-top: 1rem;
    margin-top: 1.5rem;
}
.connection-section-platform {
    border-top-color: #9ca3af;
    background: #f3f4f6;
}
.connection-section-head {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}
.connection-section-head h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0;
}
.connection-section-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== Hub sector grid ===== */
.sector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin: 3rem 0 4rem;
}
.sector-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1.5rem 1.5rem 1.25rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    position: relative;
}
.sector-card .sector-short {
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #9ca3af;
}
.sector-card h2 {
    font-size: 1.125rem;
    margin: 0;
    color: #0f172a;
    font-weight: 600;
    padding-right: 3rem;
}
.sector-card p {
    color: #4b5563;
    font-size: 0.9375rem;
    margin: 0;
    line-height: 1.45;
}
.sector-card .sector-status {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-top: 0.5rem;
}
.sector-card.sector-live {
    cursor: pointer;
    border-color: #0066b3;
}
.sector-card.sector-live:hover {
    border-color: #004a82;
    box-shadow: 0 4px 14px rgba(0, 102, 179, 0.16);
    transform: translateY(-1px);
}
.sector-card.sector-live .status-live { color: #0066b3; }
.sector-card.sector-locked { opacity: 0.7; }
.sector-card.sector-locked .status-locked { color: #9ca3af; }
.sector-card.sector-planned { opacity: 0.55; }
.sector-card.sector-planned .status-planned { color: #9ca3af; }

/* Tdh wordmark — paired with the Tutator wordmark in the hero. */
.logo-img-tdh { height: 44px; width: auto; display: block; }
