﻿/**
 * Shared virtual page template styles.
 *
 * Used by finance/investment templates such as Economy and Policy.
 * Keep selectors generic so future template pages can reuse the same layout,
 * cards, tables, charts, filters, and action controls without page-specific CSS.
 */

/**
 * Shared template styles: economy modules.
 */

.template-page,
.template-page * {
    box-sizing: border-box;
}

.template-page {
    min-height: 100vh;
    background: var(--bg-gray-50, #f9fafb);
    color: var(--text-primary, #1f2937);
	transition: background var(--transition-normal, 0.3s ease), color var(--transition-normal, 0.3s ease);
}

.template-page__inner {
    width: min(100%, 1280px);
    margin: 0 auto;
    padding: 0 var(--spacing-lg, 24px) 48px;
}

.template-page__sections {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.template-page .sp-breadcrumb {
    margin-bottom: var(--spacing-lg, 24px);
}

/* Market virtual pages restored from the legacy branch still use utility-heavy markup.
   These scoped rules align their shell, cards, tabs, and tables with template pages. */
.market-subpage-nav-wrapper {
    margin-bottom: var(--spacing-lg, 24px);
    overflow-x: auto;
    scrollbar-width: thin;
}

/* Shared market shell patterns migrated from utility-heavy templates. */
.market-breadcrumb { margin-bottom: var(--spacing-lg, 24px); }
.market-breadcrumb__nav { display: flex; align-items: center; gap: 8px; color: var(--text-muted, #6b7280); font-size: .75rem; }
.market-breadcrumb__link { color: var(--primary, #123e8a); text-decoration: none; transition: color .2s ease; }
.market-breadcrumb__link:hover { color: var(--primary-hover, #0d2d65); }
.market-breadcrumb__current { color: var(--text-secondary, #4b5563); font-weight: 600; }
.market-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.market-hero__title { margin: 0; color: var(--text-primary, #1f2937); font-size: clamp(1.5rem, 3vw, 1.875rem); font-weight: 800; line-height: 1.25; }
.market-hero__description { margin: 4px 0 0; color: var(--text-muted, #6b7280); font-size: .875rem; }
.market-hero__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.market-action { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: var(--radius-sm, 8px); font-size: .75rem; font-weight: 700; text-decoration: none; transition: opacity .2s ease; }
.market-action:hover { opacity: .9; }
.market-action--primary { color: #fff; background: var(--primary, #123e8a); }
.market-action--secondary { color: var(--text-secondary, #4b5563); background: var(--bg-gray-100, #f1f5f9); }
.market-snapshot { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 16px; }
.market-snapshot__item { min-width: 0; font-size: .75rem; font-weight: 700; }
.market-snapshot__label { display: block; color: var(--text-muted, #6b7280); }
.market-snapshot__value { display: block; margin-top: 4px; color: var(--text-primary, #1f2937); font-size: 1rem; }
.market-snapshot__value--negative { color: #e11d48; }
.market-layout { display: grid; gap: var(--spacing-lg, 24px); }
.market-layout--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.market-card { display: flex; flex-direction: column; justify-content: space-between; }
.market-card--span-two { grid-column: span 2; }
.market-chart-placeholder { position: relative; display: flex; align-items: center; justify-content: center; min-height: 240px; overflow: hidden; background: var(--bg-gray-50, #f9fafb); border: 1px solid var(--border-light, #e5e7eb); border-radius: var(--radius-sm, 8px); }
.market-chart__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.market-card__title { margin: 0; color: var(--text-primary, #1f2937); font-size: 1rem; font-weight: 700; }
.market-card__title--spaced { margin-bottom: 16px; }
.market-chart__legend { display: flex; gap: 8px; font-size: .75rem; }
.market-chart__legend-current { color: #10b981; }
.market-chart__legend-muted { color: var(--text-muted, #9ca3af); }
.market-chart__placeholder-label { color: var(--text-muted, #6b7280); font-size: .75rem; }
.market-chart__svg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .2; pointer-events: none; }
.market-stack { display: grid; }
.market-stack--sm { gap: var(--spacing-sm, 12px); }
.market-text-small { font-size: .75rem; }
.market-list-item { padding: 12px; color: var(--text-primary, #1f2937); background: var(--bg-gray-50, #f9fafb); border-radius: var(--radius-sm, 8px); }
.market-list-item span { display: block; font-weight: 700; }
.market-value-row { display: flex; justify-content: space-between; gap: 12px; color: var(--text-primary, #1f2937); font-weight: 500; }
.market-value-row span:last-child { font-weight: 700; }
.market-alert { padding: 8px; border-radius: var(--radius-sm, 8px); border: 1px solid transparent; }
.market-alert--positive { color: #047857; background: #ecfdf5; border-color: #d1fae5; font-weight: 700; }
.market-progress { display: inline-flex; width: 64px; height: 8px; align-self: center; overflow: hidden; background: var(--bg-gray-100, #f1f5f9); border-radius: 999px; }
.market-progress__fill { display: block; height: 100%; }
.market-progress__fill--blue { background: #3b82f6; }
.market-progress__fill--orange { background: #f97316; }
.market-progress__fill--green { background: #10b981; }
.market-card--macro { gap: var(--spacing-md, 16px); }
.market-list-item__label { display: block; color: var(--text-muted, #6b7280); font-weight: 700; }
.market-list-item__value { display: block; margin-top: 4px; color: var(--text-primary, #1f2937); font-weight: 800; }
.market-alert--negative { color: #9f1239; background: #fff1f2; border-color: #ffe4e6; }
.market-alert__title { display: block; font-weight: 700; }
.market-alert__meta { display: block; margin-top: 4px; font-size: .625rem; opacity: .8; }
.market-table-card { min-width: 0; }
.market-table-wrap { overflow-x: auto; font-size: .75rem; }
.market-table { width: 100%; min-width: 560px; text-align: left; font-weight: 500; }
.market-table__head-row { color: var(--text-muted, #9ca3af); border-bottom: 1px solid var(--border-light, #e5e7eb); }
.market-table__head-row th { padding-bottom: 8px; font-weight: 700; }
.market-table__body { color: var(--text-secondary, #4b5563); }
.market-table__body tr { border-bottom: 1px solid var(--border-light, #e5e7eb); }
.market-table__body tr:last-child { border-bottom: 0; }
.market-table__body td { padding: 10px 0; }
.market-table__body td:first-child { color: var(--text-primary, #1f2937); font-weight: 700; }
.market-tools-card { gap: var(--spacing-md, 16px); }
.market-tool-note { padding: 12px; color: var(--text-secondary, #4b5563); background: var(--bg-gray-50, #f9fafb); border-radius: var(--radius-sm, 8px); font-weight: 600; line-height: 1.6; }
.market-watch-item { display: flex; justify-content: space-between; gap: 12px; padding: 8px; color: var(--text-primary, #1f2937); background: var(--bg-gray-50, #f9fafb); border-radius: var(--radius-sm, 8px); font-weight: 600; }
.market-watch-item__value { color: #059669; }
@media (max-width: 767px) {
    .market-hero { align-items: flex-start; flex-direction: column; }
    .market-snapshot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .market-layout--three { grid-template-columns: 1fr; }
    .market-card--span-two { grid-column: auto; }
}

.market-page .rounded-2xl {
    border-radius: var(--radius-md, 12px);
}

.market-page .rounded-xl,
.market-page .rounded-lg {
    border-radius: var(--radius-sm, 8px);
}

.market-page button.rounded-full,
.market-page a.rounded-full,
.market-page span.rounded-full {
    border-radius: var(--radius-sm, 8px);
}

.market-page .h-2.w-2.rounded-full,
.market-page .h-1\.5.w-1\.5.rounded-full,
.market-page .w-12.h-12.rounded-full {
    border-radius: 999px;
}

.market-page .bg-white {
    background: var(--bg-white, #fff);
}

.market-page .market-bg-primary,
.market-page .bg-\[\#123e8a\] {
    background: var(--primary, #123e8a);
}

.market-page .market-hover-bg-primary:hover {
    background: var(--primary-hover, #0d2d65);
}

.market-page .bg-\[\#f5f8fa\],
.market-page .bg-slate-50 {
    background: var(--bg-gray-50, #f9fafb);
}

.market-page .bg-slate-100 {
    background: #f1f5f9;
}

.market-page button.bg-slate-100,
.market-page button.bg-white,
.market-page a.bg-slate-50,
.market-page a.bg-slate-100,
.market-page a.bg-white {
    color: var(--text-secondary, #4b5563);
}

.market-page .bg-amber-500 {
    background: #f59e0b;
}

.market-page button.bg-amber-500,
.market-page a.bg-amber-500,
.market-page .bg-amber-500.text-slate-950 {
    color: #111827;
}

.market-page .border-slate-200 {
    border-color: var(--border-primary, #e5e7eb);
}

.market-page .border-slate-100,
.market-page .border-slate-250 {
    border-color: var(--border-light, #e5e7eb);
}

.market-page .shadow-sm {
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.market-page table {
    min-width: 760px;
}

.market-page .overflow-x-auto {
    scrollbar-width: thin;
}

.market-page h1 {
    color: var(--primary, #123e8a);
    margin: 0;
    font-size: clamp(1.35rem, 2vw, 1.85rem);
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.25;
}

.market-page h3,
.market-page h4,
.market-page h5 {
    margin-top: 0;
    letter-spacing: 0;
    line-height: 1.35;
}

.market-page h3.uppercase,
.market-page h4.uppercase,
.market-page h5.uppercase {
    text-transform: none;
}

.market-page .tracking-wider {
    letter-spacing: 0;
}

.market-page .market-text-primary,
.market-page .market-hover-primary:hover,
.market-page .text-\[\#123e8a\],
.market-page a:not([class*="text-"]):not(.market-bg-primary):not(.template-tab) {
    color: var(--primary, #123e8a);
}

.market-page .market-bg-primary,
.market-page a.market-bg-primary,
.market-page .bg-blue-600 {
    color: #fff;
    background: var(--primary, #123e8a);
}

.market-page .market-bg-primary:hover,
.market-page a.market-bg-primary:hover,
.market-page .bg-blue-600:hover,
.market-page .hover\:bg-blue-700:hover {
    color: #fff;
    background: var(--primary-hover, #0d2d65);
}

.market-page .text-white {
    color: #fff;
}

.market-page .text-slate-350,
.market-page .text-slate-400,
.market-page .text-slate-450,
.market-page .text-slate-500 {
    color: var(--text-muted, #6b7280);
}

.market-page .text-slate-600,
.market-page .text-slate-655,
.market-page .text-slate-700,
.market-page .text-slate-800 {
    color: var(--text-secondary, #4b5563);
}

.market-page .text-slate-900,
.market-page .text-slate-950,
.market-page .text-slate-955 {
    color: var(--text-primary, #1f2937);
}

.market-page .template-card h3,
.market-page .template-card h4,
.market-page .template-card h5 {
    color: var(--primary, #123e8a);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
}

.market-page .template-card p {
    line-height: 1.55;
}

.market-page .template-card .template-table th {
    color: var(--primary, #123e8a);
}

.market-pro-lock-wrap {
    position: relative;
}

.market-pro-lock-content {
    filter: blur(2.5px) opacity(0.5);
    pointer-events: none;
    user-select: none;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.template-section {
    width: 100%;
}

.template-section__header {
    margin-bottom: var(--spacing-lg, 24px);
}

.template-card > .template-section__header {
    margin-bottom: var(--spacing-md, 16px);
}

.template-section__header--inside {
    padding: var(--spacing-lg, 24px) var(--spacing-lg, 24px) 0;
}

.template-section__title {
    margin: 0;
    color: var(--primary, #123e8a);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.template-layout,
.template-grid,
.template-stack {
    display: grid;
    gap: var(--spacing-lg, 24px);
}



.template-layout--calendar-news {
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
}

.template-layout--two {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.template-layout--two-one {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.template-card--span-two {
    grid-column: span 2;
}

.template-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.template-grid--two,
.template-stack--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.template-grid--five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.template-grid--tight {
    gap: var(--spacing-md, 16px);
}

.template-card {
    min-width: 0;
    padding: var(--spacing-lg, 24px);
    background: var(--bg-white, #fff);
    border: 2px solid var(--border-primary, #e5e7eb);
    border-radius: var(--radius-md, 12px);
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.template-card--flush {
    padding: 0;
    overflow: hidden;
}

.template-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md, 16px);
    margin-bottom: var(--spacing-md, 16px);
}

.template-card__title {
    margin: 0;
    color: var(--primary, #123e8a);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.35;
}

.template-card__title--solo {
    margin-bottom: var(--spacing-md, 16px);
}

.template-card__source,
.template-card__description,
.template-section__description,
.template-note,
.template-empty,
.template-form-message {
    margin: 0;
    color: var(--text-muted, #9ca3af);
    font-size: 0.75rem;
    font-weight: 600;
}

.template-section__description,
.template-form-message {
    margin-top: 6px;
    color: var(--text-muted, #6b7280);
    font-size: 0.875rem;
}

.template-card__description {
    margin-bottom: var(--spacing-md, 16px);
}

.template-card__description--bottom {
    margin: var(--spacing-md, 16px) 0 0;
}

.template-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs, 8px);
    margin-bottom: var(--spacing-md, 16px);
}

.template-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    color: var(--text-muted, #9ca3af);
    background: var(--bg-gray-100, #f3f4f6);
    border: 1px solid var(--border-light, #f3f4f6);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.template-pill.is-active {
    color: var(--text-primary, #1f2937);
    background: #eef2ff;
    border-color: #dbeafe;
}

.template-feature-card,
.template-media-card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md, 16px);
}

.template-region-column {
    display: grid;
    gap: var(--spacing-md, 16px);
    align-content: start;
}

.template-region-card {
    display: grid;
    gap: var(--spacing-md, 16px);
    padding: var(--spacing-md, 16px);
}

.template-region-card__label {
    padding: 10px 12px;
    border-radius: var(--radius-sm, 8px);
    font-size: 0.875rem;
    font-weight: 900;
}

.template-tone--blue,
.template-text--blue {
    color: #1d4ed8;
    background: #eef2ff;
}

.template-tone--green,
.template-text--green {
    color: #047857;
    background: #ecfdf5;
}

.template-tone--amber,
.template-text--amber {
    color: #b45309;
    background: #fef3c7;
}

.template-tone--violet,
.template-text--violet {
    color: #6d28d9;
    background: #f5f3ff;
}

.template-tone--sky,
.template-text--sky {
    color: #0369a1;
    background: #f0f9ff;
}

.template-tone--red,
.template-text--red {
    color: #b91c1c;
    background: #fee2e2;
}

.template-text--blue,
.template-text--green,
.template-text--amber,
.template-text--violet,
.template-text--sky,
.template-text--red {
    background: transparent;
}

.template-metric-list,
.template-list--compact,
.template-progress-list {
    display: grid;
    gap: var(--spacing-xs, 8px);
}

.template-metric-list span {
    color: var(--text-primary, #1f2937);
    font-size: 0.875rem;
    font-weight: 700;
}

.template-story-card {
    padding: 0;
    overflow: hidden;
}

.template-story-card__header {
    min-height: 72px;
    padding: var(--spacing-md, 16px);
    background: var(--bg-gray-200, #e5e7eb);
}

.template-story-card .template-list--compact {
    padding: var(--spacing-md, 16px);
}

.template-story-card h3,
.template-story-card p,
.template-media-card h3,
.template-media-card p,
.template-feature-card__highlight,
.template-progress-row h3 {
    margin: 0;
}

.template-story-card h3,
.template-media-card span {
    color: var(--text-muted, #6b7280);
    font-size: 0.69rem;
    font-weight: 900;
    text-transform: uppercase;
}

.template-story-card p,
.template-media-card h3 {
    margin-top: 6px;
    color: var(--text-primary, #1f2937);
    font-size: 0.875rem;
    font-weight: 800;
    line-height: 1.35;
}

.template-list--compact span,
.template-media-card p {
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
    font-weight: 600;
}

.template-kpi-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    align-items: center;
    gap: var(--spacing-md, 16px);
    margin-bottom: var(--spacing-md, 16px);
    padding: var(--spacing-md, 16px);
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-medium, #e5e7eb);
    border-radius: var(--radius-md, 12px);
}

.template-kpi-row span {
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
    font-weight: 700;
}

.template-kpi-row strong {
    display: block;
    margin-top: 4px;
    color: var(--primary, #123e8a);
    font-size: 1rem;
    font-weight: 900;
}

.template-kpi-row small {
    color: var(--text-primary, #1f2937);
    font-size: 0.75rem;
}

.template-kpi-row svg,
.template-mini-chart svg {
    width: 100%;
    height: 100%;
    color: var(--primary, #123e8a);
}

.template-heat-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md, 16px);
    padding: var(--spacing-md, 16px);
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
}

.template-heat-tile span,
.template-weight-row > span,
.template-weight-row strong {
    color: var(--text-primary, #1f2937);
    font-size: 0.8125rem;
    font-weight: 700;
}

.template-heat-tile strong {
    font-weight: 900;
}

.template-heat-tile--positive {
    background: #e8f5ee;
}

.template-heat-tile--positive strong {
    color: #16a34a;
}

.template-heat-tile--negative {
    background: #fbeaea;
}

.template-heat-tile--negative strong {
    color: #dc2626;
}

.template-weight-list {
    display: grid;
    gap: var(--spacing-md, 16px);
}

.template-weight-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 48px;
    align-items: center;
    gap: var(--spacing-sm, 12px);
}

.template-weight-row strong {
    text-align: right;
}

.template-news-row {
    display: flex;
    gap: var(--spacing-md, 16px);
    padding: var(--spacing-sm, 12px);
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
}

.template-news-row__thumb {
    width: 80px;
    height: 64px;
    flex: 0 0 80px;
    background: #cbd5e1;
    border-radius: 6px;
}

.template-news-row h3,
.template-news-row p,
.template-panel h3 {
    margin: 0;
}

.template-news-row h3 {
    color: var(--text-primary, #1f2937);
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.35;
}

.template-news-row p {
    margin-top: 4px;
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
}

.template-tabs--static {
    display: flex;
}

.template-tabs--static .template-tab {
    cursor: default;
}

.template-tabs.template-tabs--inline {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs, 8px);
    margin-bottom: 0;
}

.template-panel {
    padding: var(--spacing-md, 16px);
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-medium, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
}

.template-panel h3 {
    margin-bottom: var(--spacing-xs, 8px);
    color: var(--text-primary, #1f2937);
    font-size: 0.75rem;
    font-weight: 800;
}

.template-simple-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 4px;
    height: 128px;
    margin-top: var(--spacing-md, 16px);
}

.template-simple-bars__bar {
    display: block;
    width: 100%;
    height: var(--template-value, 0%);
}

.template-simple-bars__bar--blue {
    background: #2563eb;
}

.template-simple-bars__bar--sky {
    background: #0ea5e9;
}

.template-flow-bars {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: var(--spacing-sm, 12px);
    height: 128px;
    margin-top: var(--spacing-md, 16px);
}

.template-flow-bars::before {
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    height: 1px;
    background: var(--border-medium, #d1d5db);
    content: "";
}

.template-flow-bars__item {
    position: relative;
    display: grid;
    grid-template-rows: 1fr 1fr auto;
    flex: 1;
    gap: 2px;
    min-width: 0;
}

.template-flow-bars__pos,
.template-flow-bars__neg {
    display: flex;
    width: 100%;
}

.template-flow-bars__pos {
    align-items: flex-end;
}

.template-flow-bars__neg {
    align-items: flex-start;
}

.template-flow-bars__bar {
    display: block;
    width: 100%;
}

.template-flow-bars__bar--positive {
    height: var(--template-positive, 0%);
    background: #16a34a;
}

.template-flow-bars__bar--negative {
    height: var(--template-negative, 0%);
    background: #dc2626;
}

.template-flow-bars__item span {
    color: var(--text-muted, #6b7280);
    font-size: 0.625rem;
    text-align: center;
}

.template-wide-chart {
    position: relative;
    height: 192px;
    padding: var(--spacing-md, 16px);
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-medium, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
}

.template-wide-chart svg {
    width: 100%;
    height: 100%;
}

.template-wide-chart--compact {
    height: 170px;
    margin-bottom: var(--spacing-md, 16px);
}

.template-mini-chart--framed {
    height: 112px;
    padding: 6px;
    background: var(--bg-white, #fff);
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
}

.template-legend--floating {
    position: absolute;
    top: var(--spacing-md, 16px);
    right: var(--spacing-md, 16px);
    margin: 0;
}

.template-input--compact {
    width: auto;
    min-height: 34px;
}

.template-report-link {
    color: var(--text-primary, #1f2937);
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
}

.template-report-link:hover {
    color: var(--primary, #123e8a);
}

.template-tool-chart {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 12px);
}

.template-tool-chart__title {
    margin: 0;
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.5;
    text-transform: uppercase;
}

.template-market-card {
    min-height: 240px;
}

.template-market-card__title,
.template-report-card__title {
    margin-bottom: var(--spacing-sm, 12px);
    font-size: 0.95rem;
}

.template-report-card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 12px);
}

.template-report-card p {
    margin: 0;
    color: var(--text-muted, #6b7280);
    font-size: 0.875rem;
    line-height: 1.55;
}

.template-report-card__thumb {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 96px;
    padding: var(--spacing-md, 16px);
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: var(--radius-md, 12px);
}

.template-report-card__thumb span {
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
    font-weight: 800;
}

.template-badge--success {
    color: #065f46;
    background: #d1fae5;
}

.template-badge--warning {
    color: #7c2d12;
    background: #fef3c7;
}

.template-list-item.template-list-item--news {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 32px 56px;
    align-items: center;
    gap: var(--spacing-md, 16px);
    white-space: nowrap;
}

.template-list-item.template-list-item--news .template-list-item__title {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-list-item.template-list-item--news span {
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
    font-weight: 600;
}

.template-list-item.template-list-item--news span:last-child {
    text-align: right;
}

.template-forecast {
    display: grid;
    gap: var(--spacing-lg, 24px);
}

.template-forecast__row {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr) 10rem;
    align-items: center;
    gap: var(--spacing-lg, 24px);
}

.template-forecast__label,
.template-sector__label {
    margin: 0;
    color: var(--text-primary, #1f2937);
    font-size: 0.875rem;
    font-weight: 800;
}

.template-forecast__range {
    margin: 0;
    color: var(--text-muted, #9ca3af);
    font-size: 0.75rem;
    font-weight: 600;
}

.template-progress,
.template-sector__track {
    position: relative;
    height: 16px;
    overflow: hidden;
    background: #e8f1ff;
    border-radius: 999px;
}

.template-progress__fill,
.template-sector__fill {
    display: block;
    width: var(--template-value, 0%);
    height: 100%;
    border-radius: inherit;
}

.template-progress__fill {
    background: #7db5ff;
}

.template-progress__marker {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--template-value, 0%);
    width: 2px;
    background: #2563eb;
}

.template-calendar {
    display: grid;
    gap: var(--spacing-md, 16px);
}

.template-calendar__date {
    margin: 0 0 var(--spacing-xs, 8px);
    padding: 10px 12px;
    color: var(--text-secondary, #6b7280);
    background: var(--bg-gray-50, #f9fafb);
    border-radius: var(--radius-sm, 8px);
    font-size: 0.75rem;
    font-weight: 800;
}

.template-calendar__events {
    display: grid;
    gap: var(--spacing-xs, 8px);
}

.template-event {
    display: grid;
    grid-template-columns: 28px 44px 42px minmax(150px, 1fr) 76px 76px 72px;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-white, #fff);
    border: 1px solid var(--border-light, #f3f4f6);
    border-radius: var(--radius-sm, 8px);
}

.template-event__country {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: #fff;
    background: #0ea5e9;
    border-radius: 50%;
    font-size: 0.56rem;
    font-weight: 900;
}

.template-event__time,
.template-event__meta,
.template-event__actual {
    color: var(--text-muted, #9ca3af);
    font-size: 0.75rem;
}

.template-event__time,
.template-event__actual {
    font-weight: 800;
}

.template-event__actual,
.template-event__title {
    color: var(--text-primary, #1f2937);
}

.template-event__title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
}

.template-impact {
    display: inline-flex;
    gap: 2px;
}

.template-impact__dot {
    width: 6px;
    height: 6px;
    background: var(--border-medium, #e5e7eb);
    border-radius: 50%;
}

.template-impact__dot.is-active {
    background: #f59e0b;
}

.template-news-list,
.template-alert-list,
.template-report-list,
.template-sector-list {
    display: grid;
    gap: var(--spacing-sm, 12px);
}

.template-news-item {
    display: flex;
    gap: var(--spacing-sm, 12px);
    padding: var(--spacing-sm, 12px);
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-light, #f3f4f6);
    border-radius: var(--radius-md, 12px);
}

.template-news-item__thumb {
    width: 44px;
    height: 40px;
    flex: 0 0 44px;
    object-fit: cover;
    background: #eef2ff;
    border-radius: 6px;
}

.template-news-item__title {
    margin: 0;
    color: var(--text-primary, #1f2937);
    font-size: 0.875rem;
    font-weight: 800;
    line-height: 1.35;
}

.template-news-item__title a {
    color: inherit;
    text-decoration: none;
}

.template-news-item__summary {
    margin: 3px 0 0;
    color: var(--text-muted, #9ca3af);
    font-size: 0.75rem;
}

.template-chart,
.template-donut,
.template-bars {
    min-height: 140px;
    padding: var(--spacing-sm, 12px);
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-medium, #e5e7eb);
    border-radius: var(--radius-md, 12px);
}

.template-section--comparative .template-chart {
    height: 220px;
}

.template-chart__svg {
    width: 100%;
    height: 100%;
}

.template-chart-line--blue,
.template-legend__swatch--blue,
.template-bars__bar--export,
.template-sector__fill--blue {
    stroke: #2563eb;
    background: #2563eb;
}

.template-chart-line--green,
.template-legend__swatch--green,
.template-sector__fill--green {
    stroke: #10b981;
    background: #10b981;
}

.template-chart-line--amber,
.template-chart-line--orange,
.template-legend__swatch--amber,
.template-sector__fill--amber {
    stroke: #f59e0b;
    background: #f59e0b;
}

.template-chart-line--rose,
.template-legend__swatch--rose {
    stroke: #f43f5e;
    background: #f43f5e;
}

.template-chart-line--violet,
.template-chart-line--purple,
.template-legend__swatch--violet,
.template-sector__fill--violet {
    stroke: #a78bfa;
    background: #a78bfa;
}

.template-chart-line--red,
.template-legend__swatch--red,
.template-bars__bar--import {
    stroke: #ef4444;
    background: #ef4444;
}

.template-chart-grid-line {
    stroke: var(--border-medium, #d1d5db);
}

.template-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm, 12px) var(--spacing-md, 16px);
    margin-top: var(--spacing-sm, 12px);
}

.template-section--comparative .template-legend {
    margin: 0 0 var(--spacing-md, 16px);
}

.template-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted, #9ca3af);
    font-size: 0.75rem;
    font-weight: 600;
}

.template-legend__swatch--blue,
.template-legend__swatch--green,
.template-legend__swatch--amber,
.template-legend__swatch--rose,
.template-legend__swatch--violet,
.template-legend__swatch--red,
.template-legend__swatch--sky,
.template-legend__swatch--emerald {
    width: 16px;
    height: 6px;
    border-radius: 2px;
}

.template-legend__swatch--sky,
.template-sector__fill--sky {
    background: #60a5fa;
}

.template-legend__swatch--emerald,
.template-sector__fill--emerald {
    background: #34d399;
}

.template-donut {
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-donut__svg {
    width: 112px;
    height: 112px;
}

.template-donut__segment--sky {
    stroke: #60a5fa;
}

.template-donut__segment--emerald {
    stroke: #34d399;
}

.template-donut__segment--amber {
    stroke: #f59e0b;
}

.template-donut__segment--violet {
    stroke: #a78bfa;
}

.template-donut__segment--rose {
    stroke: #f43f5e;
}

.template-bars {
    display: flex;
    align-items: end;
    justify-content: space-around;
    gap: var(--spacing-xs, 8px);
}

.template-bars__month {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.template-bars__pair {
    display: flex;
    align-items: end;
    gap: 3px;
    height: 90px;
}

.template-bars__bar {
    display: block;
    width: 12px;
    height: var(--template-value, 0%);
    border-radius: 3px 3px 0 0;
}

.template-bars__label {
    color: var(--text-muted, #9ca3af);
    font-size: 0.625rem;
}

.template-sector__label {
    margin-bottom: 6px;
    font-size: 0.75rem;
}

.template-table-wrap {
    overflow-x: auto;
    scrollbar-width: thin;
}

.template-heatmap-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    text-align: left;
}

.template-heatmap-table th {
    padding: 0 8px 12px;
    color: var(--text-muted, #9ca3af);
    font-size: 0.75rem;
    font-weight: 800;
}

.template-heatmap-table td {
    padding: 8px;
    border-top: 1px solid var(--border-light, #f3f4f6);
}

.template-heatmap-table tbody th {
    padding: 8px 8px 8px 0;
    color: var(--text-secondary, #6b7280);
    border-top: 1px solid var(--border-light, #f3f4f6);
}

.template-heatmap-cell--red,
.template-heatmap-cell--pink,
.template-heatmap-cell--green,
.template-heatmap-cell--lgreen,
.template-heatmap-cell--gray {
    display: block;
    width: 100%;
    min-width: 44px;
    height: 28px;
    border-radius: var(--radius-sm, 8px);
}

.template-heatmap-cell--red {
    background: #f87171;
}

.template-heatmap-cell--pink {
    background: #fca5a5;
}

.template-heatmap-cell--green {
    background: #22c55e;
}

.template-heatmap-cell--lgreen {
    background: #86efac;
}

.template-heatmap-cell--gray {
    background: var(--bg-gray-200, #e5e7eb);
}

.template-note {
    margin-top: var(--spacing-sm, 12px);
}

.template-feature-card {
    justify-content: space-between;
}

.template-feature-card__highlight {
    margin-bottom: var(--spacing-md, 16px);
    font-size: 0.875rem;
    font-weight: 900;
}

.template-donut--entry {
    min-height: 156px;
    margin: var(--spacing-lg, 24px) 0;
}

.template-donut--entry .template-donut__svg {
    width: 128px;
    height: 128px;
}

.template-tax-chart {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: var(--spacing-sm, 12px);
    height: 140px;
    margin: var(--spacing-lg, 24px) 0;
    padding: 36px var(--spacing-md, 16px) var(--spacing-md, 16px);
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-medium, #e5e7eb);
    border-radius: var(--radius-md, 12px);
}

.template-tax-chart__legend {
    position: absolute;
    top: 12px;
    left: var(--spacing-md, 16px);
    display: flex;
    gap: var(--spacing-md, 16px);
}

.template-tax-chart__legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
    font-weight: 600;
}

.template-tax-chart__group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.template-tax-chart__bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    flex: 1;
}

.template-tax-chart__bar {
    display: block;
    width: 24px;
    height: var(--template-value, 0%);
    border-radius: 3px 3px 0 0;
}

.template-tax-chart__bar--cit {
    background: #0ea5e9;
}

.template-tax-chart__bar--vat {
    background: #a78bfa;
}

.template-tax-chart__group > span {
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
    font-weight: 600;
}

.template-media-card {
    min-height: 200px;
    overflow: hidden;
    padding: var(--spacing-md, 16px);
}

.template-media-card__thumb {
    height: 96px;
    margin: calc(var(--spacing-md, 16px) * -1) calc(var(--spacing-md, 16px) * -1) 0;
    background: var(--bg-gray-200, #e5e7eb);
}

.template-trend-card {
    justify-content: center;
    min-height: 160px;
}

.template-trend-card h3,
.template-trend-card p {
    margin: 0;
}

.template-trend-card h3 {
    margin-bottom: var(--spacing-xs, 8px);
    font-size: 1rem;
    font-weight: 900;
}

.template-trend-card .template-list--compact span {
    color: var(--text-primary, #1f2937);
    font-size: 0.875rem;
    font-weight: 600;
}

.template-trend-card--blue {
    background: #eff6ff;
    border-color: #dbeafe;
}

.template-trend-card--green {
    background: #ecfdf5;
    border-color: #d1fae5;
}

.template-mini-chart {
    height: 112px;
    margin-bottom: var(--spacing-md, 16px);
}

.template-bars--compact {
    height: 140px;
    min-height: 140px;
}

.template-bars--compact .template-bars__month {
    justify-content: flex-end;
}

.template-bars--compact .template-bars__bar {
    width: min(100%, 40px);
}

.template-bars--fdi .template-bars__bar {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 6px 6px 0 0;
}

.template-progress-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 52px minmax(160px, 260px);
    align-items: center;
    gap: var(--spacing-md, 16px);
}

.template-progress-row h3 {
    color: var(--text-primary, #1f2937);
    font-size: 0.875rem;
    font-weight: 900;
}

.template-progress-row strong {
    color: var(--text-primary, #1f2937);
    font-size: 0.875rem;
    text-align: right;
}

.template-progress-row span {
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
    font-weight: 600;
}

.template-alert-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--spacing-xs, 8px);
    margin-bottom: var(--spacing-md, 16px);
}

.template-input {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    color: var(--text-primary, #1f2937);
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-medium, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
    font-size: 0.75rem;
    outline: none;
    transition: border-color var(--transition-normal, 0.3s ease), box-shadow var(--transition-normal, 0.3s ease);
}

.template-input:focus {
    border-color: var(--primary, #123e8a);
    box-shadow: 0 0 0 3px rgba(18, 62, 138, 0.12);
}

.template-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 12px;
    color: var(--primary, #123e8a);
    background: #eef2ff;
    border: 1px solid #dbeafe;
    border-radius: var(--radius-sm, 8px);
    font-size: 0.75rem;
    font-weight: 800;
}

.template-button__icon,
.template-report__icon {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.template-button:disabled {
    cursor: not-allowed;
    opacity: 0.75;
}

.template-subtitle {
    margin: 0 0 var(--spacing-xs, 8px);
    color: var(--text-muted, #9ca3af);
    font-size: 0.75rem;
    font-weight: 800;
}

.template-alert-item {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) minmax(6rem, 7.5rem) minmax(8.75rem, 10.5rem);
    align-items: center;
    gap: var(--spacing-sm, 12px);
    padding: 10px 12px;
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-light, #f3f4f6);
    border-radius: var(--radius-sm, 8px);
}

.template-report {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm, 12px);
    padding: 10px 12px;
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-light, #f3f4f6);
    border-radius: var(--radius-sm, 8px);
}

.template-alert-item__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: var(--primary, #123e8a);
    background: #eef2ff;
    border-radius: 50%;
}

.template-alert-item__icon--fire {
    color: #dc2626;
    background: #fee2e2;
}

.template-alert-item__icon--warning {
    color: #b45309;
    background: #fef3c7;
}

.template-alert-item__icon--check {
    color: #047857;
    background: #ecfdf5;
}

.template-alert-item__svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.template-alert-item__title,
.template-report__title {
    margin: 0;
    color: var(--text-primary, #1f2937);
    font-size: 0.75rem;
    font-weight: 800;
}

.template-alert-item__title {
    min-width: 0;
}

.template-alert-item__source {
    min-width: 0;
    color: var(--text-muted, #9ca3af);
    font-size: 0.69rem;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-report__title {
    flex: 1;
}

.template-report__summary {
    color: var(--text-muted, #9ca3af);
    font-size: 0.69rem;
}

.template-status--info,
.template-status--success,
.template-pro-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 0.625rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
}

.template-status--info,
.template-status--success {
    width: 100%;
    white-space: normal;
}

.template-status--info {
    color: #1d4ed8;
    background: #eef2ff;
}

.template-status--success {
    color: #047857;
    background: #ecfdf5;
}

.template-pro-badge {
    color: #b45309;
    background: #fef3c7;
}

.template-card--reports {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md, 16px);
}

.template-card--reports .template-card__header {
    margin-bottom: 0;
}

.template-report-list {
    flex: 1;
    gap: var(--spacing-md, 16px);
}

.template-report {
    min-height: 74px;
    padding: var(--spacing-md, 16px);
    border-radius: var(--radius-md, 12px);
}

.template-report__body {
    flex: 1;
}

.template-report__summary {
    margin: 6px 0 0;
    line-height: 1.45;
}

.template-report__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    min-width: 52px;
    padding: 7px 12px;
    color: #1d4ed8;
    background: #eef2ff;
    border-radius: var(--radius-sm, 8px);
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    text-align: center;
}

body.dark-mode .template-page {
    background: #202225;
    color: #f3f4f6;
}

body.dark-mode .template-card,
body.dark-mode .template-event {
    background: #2a2d35;
    border-color: #374151;
}

body.dark-mode .market-page .bg-white,
body.dark-mode .market-page .dark\:bg-\[\#2a2d35\] {
    background: #2a2d35;
}

body.dark-mode .market-page .bg-slate-50,
body.dark-mode .market-page .bg-slate-100,
body.dark-mode .market-page .dark\:bg-\[\#202225\],
body.dark-mode .market-page .dark\:bg-slate-800,
body.dark-mode .market-page .dark\:bg-slate-850 {
    background: rgba(31, 41, 55, 0.55);
}

body.dark-mode .market-page button.bg-slate-100,
body.dark-mode .market-page button.bg-white,
body.dark-mode .market-page a.bg-slate-50,
body.dark-mode .market-page a.bg-slate-100,
body.dark-mode .market-page a.bg-white {
    color: #e5e7eb;
}

body.dark-mode .market-page .bg-amber-500 {
    background: #f59e0b;
}

body.dark-mode .market-page button.bg-amber-500,
body.dark-mode .market-page a.bg-amber-500,
body.dark-mode .market-page .bg-amber-500.text-slate-950 {
    color: #111827;
}

body.dark-mode .market-page .market-bg-primary,
body.dark-mode .market-page .bg-\[\#123e8a\],
body.dark-mode .market-page .dark\:bg-\[\#1e40af\] {
    background: rgba(30, 64, 175, 0.9);
}

body.dark-mode .market-page .market-hover-bg-primary:hover {
    background: #1d4ed8;
}

body.dark-mode .market-page .border-slate-200,
body.dark-mode .market-page .dark\:border-slate-700 {
    border-color: #374151;
}

body.dark-mode .market-page .border-slate-100,
body.dark-mode .market-page .border-slate-250,
body.dark-mode .market-page .dark\:border-slate-650,
body.dark-mode .market-page .dark\:border-slate-800 {
    border-color: #374151;
}

body.dark-mode .market-page .text-slate-900,
body.dark-mode .market-page .dark\:text-white {
    color: #f9fafb;
}

body.dark-mode .market-page h1 {
    color: #dbeafe;
}

body.dark-mode .market-page .template-card h3,
body.dark-mode .market-page .template-card h4,
body.dark-mode .market-page .template-card h5 {
    color: #bfdbfe;
}

body.dark-mode .market-page .market-text-primary,
body.dark-mode .market-page .market-hover-primary:hover,
body.dark-mode .market-page .text-\[\#123e8a\],
body.dark-mode .market-page .dark\:text-\[\#60a5fa\],
body.dark-mode .market-page a:not([class*="text-"]):not(.market-bg-primary):not(.template-tab) {
    color: #bfdbfe;
}

body.dark-mode .market-page .market-bg-primary,
body.dark-mode .market-page a.market-bg-primary,
body.dark-mode .market-page .bg-blue-600 {
    color: #fff;
    background: rgba(30, 64, 175, 0.9);
}

body.dark-mode .market-page .market-bg-primary:hover,
body.dark-mode .market-page a.market-bg-primary:hover,
body.dark-mode .market-page .bg-blue-600:hover,
body.dark-mode .market-page .hover\:bg-blue-700:hover {
    color: #fff;
    background: #1d4ed8;
}

body.dark-mode .market-page .text-slate-350,
body.dark-mode .market-page .text-slate-400,
body.dark-mode .market-page .text-slate-450,
body.dark-mode .market-page .text-slate-500,
body.dark-mode .market-page .dark\:text-slate-400,
body.dark-mode .market-page .dark\:text-slate-500,
body.dark-mode .market-page .dark\:text-slate-600 {
    color: #9ca3af;
}

body.dark-mode .market-page .text-slate-600,
body.dark-mode .market-page .text-slate-655,
body.dark-mode .market-page .text-slate-700,
body.dark-mode .market-page .text-slate-800,
body.dark-mode .market-page .text-slate-950,
body.dark-mode .market-page .text-slate-955,
body.dark-mode .market-page .dark\:text-slate-200,
body.dark-mode .market-page .dark\:text-slate-300 {
    color: #e5e7eb;
}

body.dark-mode .template-calendar__date,
body.dark-mode .template-news-item,
body.dark-mode .template-news-row,
body.dark-mode .template-panel,
body.dark-mode .template-wide-chart,
body.dark-mode .template-chart,
body.dark-mode .template-donut,
body.dark-mode .template-bars,
body.dark-mode .template-story-card__header,
body.dark-mode .template-tax-chart,
body.dark-mode .template-kpi-row,
body.dark-mode .template-alert-item,
body.dark-mode .template-report,
body.dark-mode .template-input,
body.dark-mode .template-toolbar--wrap,
body.dark-mode .template-report-card__thumb,
body.dark-mode .template-mini-chart--framed,
body.dark-mode .template-segmented {
    background: rgba(31, 41, 55, 0.55);
    border-color: #374151;
}

body.dark-mode .template-event__title,
body.dark-mode .template-event__actual,
body.dark-mode .template-news-item__title,
body.dark-mode .template-news-row h3,
body.dark-mode .template-panel h3,
body.dark-mode .template-heat-tile span,
body.dark-mode .template-weight-row > span,
body.dark-mode .template-weight-row strong,
body.dark-mode .template-forecast__label,
body.dark-mode .template-sector__label,
body.dark-mode .template-metric-list span,
body.dark-mode .template-story-card p,
body.dark-mode .template-media-card h3,
body.dark-mode .template-trend-card p,
body.dark-mode .template-progress-row h3,
body.dark-mode .template-progress-row strong,
body.dark-mode .template-alert-item__title,
body.dark-mode .template-report__title {
    color: #f9fafb;
}

body.dark-mode .template-progress,
body.dark-mode .template-sector__track,
body.dark-mode .template-pill {
    background: #374151;
}

body.dark-mode .template-pill.is-active,
body.dark-mode .template-button,
body.dark-mode .template-segmented__button.is-active,
body.dark-mode .template-report__link,
body.dark-mode .template-status--info {
    color: #bfdbfe;
    background: rgba(30, 64, 175, 0.35);
    border-color: rgba(96, 165, 250, 0.25);
}

body.dark-mode .template-alert-item__icon--fire {
    color: #fca5a5;
    background: rgba(127, 29, 29, 0.35);
}

body.dark-mode .template-alert-item__icon--warning {
    color: #fbbf24;
    background: rgba(120, 53, 15, 0.35);
}

body.dark-mode .template-alert-item__icon--check {
    color: #6ee7b7;
    background: rgba(6, 95, 70, 0.35);
}

body.dark-mode .template-status--success {
    color: #6ee7b7;
    background: rgba(6, 95, 70, 0.35);
}

body.dark-mode .template-pro-badge {
    color: #fbbf24;
    background: rgba(120, 53, 15, 0.35);
}

body.dark-mode .template-trend-card--blue {
    background: rgba(30, 64, 175, 0.2);
    border-color: rgba(96, 165, 250, 0.25);
}

body.dark-mode .template-trend-card--green {
    background: rgba(6, 95, 70, 0.2);
    border-color: rgba(16, 185, 129, 0.25);
}

body.dark-mode .template-bars--fdi .template-bars__bar {
    background: rgba(30, 64, 175, 0.5);
    border-color: rgba(96, 165, 250, 0.45);
}

body.dark-mode .template-heat-tile--positive {
    background: #0f2a1a;
}

body.dark-mode .template-heat-tile--negative {
    background: #2a1414;
}

body.dark-mode .template-news-row__thumb {
    background: #2b3a50;
}

@media (max-width: 1024px) {
    .template-layout--calendar-news,
    .template-layout--two,
    .template-layout--two-one,
    .template-grid--five,
    .template-grid--three,
    .template-grid--two,
    .template-stack--two {
        grid-template-columns: 1fr;
    }

    .template-card--span-two {
        grid-column: auto;
    }

    .template-event {
        grid-template-columns: 28px 44px 42px minmax(160px, 1fr);
    }

    .template-event__meta,
    .template-event__actual {
        display: none;
    }
}

@media (max-width: 768px) {
    .template-page__inner {
        padding: 0 var(--spacing-md) 36px;
    }

    .template-page__sections {
        gap: 36px;
    }

    .template-card {
        padding: var(--spacing-md);
    }

    .template-card--flush {
        padding: 0;
    }

    .template-card__header {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .template-card__title,
    .template-section__title {
        font-size: 1.2rem;
    }

    .template-forecast__row {
        grid-template-columns: 1fr;
        gap: var(--spacing-xs);
    }

    .template-alert-form {
        grid-template-columns: 1fr;
    }

    .template-progress-row {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .template-progress-row strong {
        text-align: left;
    }

}

@media (max-width: 640px) {
    .template-event {
        grid-template-columns: 28px 42px minmax(0, 1fr);
    }

    .template-impact {
        display: none;
    }

    .template-alert-item,
    .template-report {
        align-items: flex-start;
        flex-direction: column;
    }

    .template-alert-item {
        display: flex;
    }

    .template-alert-item__source {
        text-align: left;
        white-space: normal;
    }

    .template-status--info,
    .template-status--success {
        width: auto;
    }
}

/**
 * Shared template styles: policy modules.
 */

.template-highlight {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 12px);
    min-height: 150px;
}

.template-highlight__top,
.template-topic__header,
.template-alert-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-md, 16px);
}

.template-highlight__meta,
.template-topic__meta span,
.template-report span {
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
    font-weight: 700;
}

.template-highlight__title,
.template-topic__title,
.template-timeline-event__title,
.template-list-item strong {
    margin: 0;
    color: var(--text-primary, #1f2937);
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.35;
}

.template-highlight__summary,
.template-topic__content {
    margin: 0;
    color: var(--text-muted, #6b7280);
    font-size: 0.875rem;
    line-height: 1.45;
}

.template-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.69rem;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
}

.template-badge--positive {
    color: #047857;
    background: #ecfdf5;
}

.template-badge--neutral {
    color: #b45309;
    background: #fef3c7;
}

.template-badge--risk {
    color: #b91c1c;
    background: #fee2e2;
}

.template-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(150px, 1fr)) auto auto;
    gap: var(--spacing-xs, 8px);
    padding: var(--spacing-md, 16px);
    border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.template-toolbar--wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md, 16px);
    margin-bottom: var(--spacing-md, 16px);
    padding: var(--spacing-md, 16px);
    background: var(--bg-white, #fff);
    border: 2px solid var(--border-primary, #e5e7eb);
    border-radius: var(--radius-md, 12px);
}

.template-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs, 8px);
}

.template-filter {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.template-filter__label {
    color: var(--text-muted, #6b7280);
    font-size: 0.69rem;
    font-weight: 800;
}

.template-button,
.template-tab,
.template-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 12px;
    color: #fff;
    background: var(--primary, #123e8a);
    border: 1px solid var(--primary, #123e8a);
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 800;
    text-decoration: none;
    transition: background var(--transition-normal, 0.3s ease), color var(--transition-normal, 0.3s ease), border-color var(--transition-normal, 0.3s ease);
}

.template-button--ghost,
.template-tab {
    color: var(--primary, #123e8a);
    background: #eef2ff;
    border-color: #dbeafe;
}

.template-tab.is-active {
    color: #fff;
    background: var(--primary, #123e8a);
    border-color: var(--primary, #123e8a);
}

.template-segmented {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 4px;
    padding: 4px;
    background: var(--bg-gray-100, #f3f4f6);
    border-radius: var(--radius-md, 12px);
}

.template-segmented__button {
    min-height: 32px;
    padding: 6px 8px;
    color: var(--text-muted, #6b7280);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 800;
}

.template-segmented__button.is-active {
    color: #fff;
    background: var(--primary, #123e8a);
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.template-table-wrap {
    overflow-x: auto;
    scrollbar-width: thin;
}

.template-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    text-align: left;
}

.template-table--thematic {
    min-width: 980px;
}

.template-table th,
.template-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    font-size: 0.875rem;
    vertical-align: middle;
}

.template-table th {
    color: var(--primary, #123e8a);
    font-size: 0.75rem;
    font-weight: 800;
}

.template-table__strong {
    color: var(--text-primary, #1f2937);
    font-weight: 800;
}

.template-table tbody tr:hover {
    background: var(--bg-gray-50, #f9fafb);
}

.template-source-link {
    color: var(--text-muted, #6b7280);
    font-weight: 800;
    text-decoration: none;
}

.template-empty {
    padding: var(--spacing-md, 16px);
}

.template-topic {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 12px);
}

.template-topic__meta {
    display: grid;
    gap: 4px;
    padding-top: var(--spacing-xs, 8px);
    border-top: 1px solid var(--border-light, #e5e7eb);
}

.template-topic__meta strong {
    color: var(--text-primary, #1f2937);
    font-size: 0.8125rem;
}

.template-list-item {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--spacing-sm, 12px);
    padding: 12px;
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
}

.template-list-item time {
    color: var(--primary, #123e8a);
    font-size: 0.75rem;
    font-weight: 900;
}

.template-timeline-chart {
    position: relative;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: thin;
}

.template-timeline-chart__canvas {
    position: relative;
    height: 220px;
    min-width: 760px;
    margin: 0 24px;
}

.template-timeline-chart__track {
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    height: 2px;
    background: var(--border-medium, #d1d5db);
    transform: translateY(-50%);
}

.template-timeline-chart__tick {
    position: absolute;
    top: -7px;
    left: var(--template-timeline-pos, 0%);
    width: 2px;
    height: 16px;
    background: var(--border-medium, #d1d5db);
    transform: translateX(-50%);
}

.template-timeline-chart__years {
    position: absolute;
    top: calc(50% - 32px);
    right: 0;
    left: 0;
    height: 24px;
}

.template-timeline-chart__year {
    position: absolute;
    top: 0;
    left: var(--template-timeline-pos, 0%);
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
    font-weight: 800;
    transform: translateX(-50%);
}

.template-timeline-chart__events {
    position: absolute;
    inset: 0;
}

.template-timeline-event {
    position: absolute;
    top: calc(50% + 32px);
    left: var(--template-timeline-pos, 0%);
    width: 170px;
    transform: translateX(-50%);
    text-align: center;
}

.template-timeline-event::before {
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    width: 1px;
    height: 22px;
    background: var(--border-medium, #d1d5db);
    content: "";
    transform: translateX(-50%);
}

.template-timeline-event__dot {
    position: absolute;
    bottom: calc(100% + 22px);
    left: 50%;
    z-index: 2;
    width: 14px;
    height: 14px;
    background: var(--primary, #123e8a);
    border: 3px solid var(--bg-white, #fff);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--primary, #123e8a);
    transform: translateX(-50%);
}

.template-timeline-event--positive .template-timeline-event__dot {
    background: #10b981;
    box-shadow: 0 0 0 2px #10b981;
}

.template-timeline-event--neutral .template-timeline-event__dot {
    background: #f59e0b;
    box-shadow: 0 0 0 2px #f59e0b;
}

.template-timeline-event--risk .template-timeline-event__dot {
    background: #ef4444;
    box-shadow: 0 0 0 2px #ef4444;
}

.template-timeline-event__date {
    display: block;
    margin-bottom: 6px;
    color: var(--primary, #123e8a);
    font-size: 0.75rem;
    font-weight: 900;
}

.template-timeline-event__title {
    display: -webkit-box;
    margin: 0 0 8px;
    color: var(--text-primary, #1f2937);
    font-size: 0.875rem;
    font-weight: 800;
    -webkit-line-clamp: 2;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.template-chart {
    height: 220px;
    padding: var(--spacing-sm, 12px);
    background: var(--bg-gray-50, #f9fafb);
    border: 1px solid var(--border-medium, #d1d5db);
    border-radius: var(--radius-md, 12px);
}

.template-chart svg {
    width: 100%;
    height: 100%;
}

.template-chart__line--blue,
.template-legend__swatch--blue {
    stroke: #2563eb;
    background: #2563eb;
}

.template-chart__line--green,
.template-legend__swatch--green {
    stroke: #10b981;
    background: #10b981;
}

.template-chart__line--red,
.template-legend__swatch--red {
    stroke: #ef4444;
    background: #ef4444;
}

.template-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm, 12px);
    margin-top: var(--spacing-sm, 12px);
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
    font-weight: 700;
}

.template-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.template-legend__swatch {
    width: 16px;
    height: 6px;
    border-radius: 2px;
}

.template-risk-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.template-risk-cell {
    min-height: 44px;
    padding: 6px;
    border: 0;
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    transition: transform var(--transition-normal, 0.3s ease), box-shadow var(--transition-normal, 0.3s ease);
}

.template-risk-cell:hover {
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
    transform: scale(1.02);
}

.template-risk-cell:nth-child(1) { background: rgb(34, 197, 94); }
.template-risk-cell:nth-child(2) { background: rgb(72, 189, 78); }
.template-risk-cell:nth-child(3) { background: rgb(110, 182, 63); }
.template-risk-cell:nth-child(4) { background: rgb(149, 175, 48); }
.template-risk-cell:nth-child(5) { background: rgb(187, 168, 33); }
.template-risk-cell:nth-child(6) { background: rgb(225, 161, 18); }
.template-risk-cell:nth-child(7) { background: rgb(244, 149, 16); }
.template-risk-cell:nth-child(8) { background: rgb(243, 133, 26); }
.template-risk-cell:nth-child(9) { background: rgb(242, 117, 36); }
.template-risk-cell:nth-child(10) { background: rgb(241, 100, 47); }
.template-risk-cell:nth-child(11) { background: rgb(240, 84, 57); }
.template-risk-cell:nth-child(12) { background: rgb(239, 68, 68); }

.template-risk-cell:nth-child(n+13) {
    background: rgb(239, 68, 68);
}

.template-tabs {
    display: none;
    gap: var(--spacing-xs, 8px);
    margin-bottom: var(--spacing-md, 16px);
}

.template-list {
    display: grid;
    gap: var(--spacing-sm, 12px);
}

.template-report {
    grid-template-columns: minmax(0, 1fr) auto;
}

.template-report div {
    display: grid;
    gap: 4px;
}

.template-icon-button {
    width: 38px;
    padding: 0;
    color: var(--primary, #123e8a);
    background: #eef2ff;
    border-color: #dbeafe;
}

.template-icon-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.template-alert-form--inline {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr)) auto;
    gap: var(--spacing-xs, 8px);
    min-width: min(100%, 620px);
}

body.dark-mode .template-card,
body.dark-mode .template-input {
    background: #2a2d35;
    border-color: #374151;
}

body.dark-mode .template-highlight__title,
body.dark-mode .template-topic__title,
body.dark-mode .template-timeline-event__title,
body.dark-mode .template-list-item strong,
body.dark-mode .template-table__strong,
body.dark-mode .template-topic__meta strong {
    color: #f9fafb;
}

body.dark-mode .template-table tbody tr:hover,
body.dark-mode .template-list-item,
body.dark-mode .template-chart {
    background: rgba(31, 41, 55, 0.55);
    border-color: #374151;
}

body.dark-mode .template-timeline-event__dot {
    border-color: #2a2d35;
}

body.dark-mode .template-input {
    color: #f9fafb;
}

body.dark-mode .template-button--ghost,
body.dark-mode .template-tab,
body.dark-mode .template-icon-button {
    color: #bfdbfe;
    background: rgba(30, 64, 175, 0.35);
    border-color: rgba(96, 165, 250, 0.25);
}

body.dark-mode .template-tab.is-active {
    color: #fff;
    background: rgba(30, 64, 175, 0.9);
    border-color: rgba(30, 64, 175, 0.9);
}

@media (max-width: 1100px) {
    .template-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .template-highlight__top,
    .template-topic__header,
    .template-alert-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .template-toolbar,
    .template-alert-form--inline {
        grid-template-columns: 1fr;
    }

    .template-tabs {
        display: flex;
    }

    [data-policy-tabs] [data-policy-panel] {
        display: none;
    }

[data-policy-tabs] [data-policy-panel].is-active {
        display: block;
    }
}

@media (max-width: 768px) {
    .template-toolbar--wrap,
    .template-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .template-toolbar--wrap .template-tabs,
    .template-toolbar--wrap .template-actions,
    .template-toolbar--wrap .template-button {
        width: 100%;
    }

    .template-market-card {
        min-height: 220px;
    }
}

@media (max-width: 560px) {
    .template-list-item {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .template-list-item.template-list-item--news {
        grid-template-columns: 64px minmax(0, 1fr) 28px 48px;
        align-items: center;
        gap: var(--spacing-xs, 8px);
    }

    .template-risk-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
