/* ============================================================
   L'Action Privilégiée — Shared Stylesheet
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #ffffff;
  --bg-alt:      #f8f9fb;
  --bg-dark:     #1e2532;
  --text:        #1a1d23;
  --text-muted:  #6b7280;
  --accent:      #1d4ed8;
  --accent-dim:  #eff6ff;
  --border:      #e5e7eb;
  --border-dark: #334155;
  --issuer-bg:   #f1f5f9;
  --green:       #059669;
  --red:         #dc2626;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

html, body { max-width: 100%; overflow-x: hidden; }

body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.4;
}

/* ── Rates Header Band ─────────────────────────────────────── */
#rates-band {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-dark);
  color: #e2e8f0;
  padding: 7px 20px;
  display: flex;
  align-items: center;
  font-size: 12px;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
#rates-band::-webkit-scrollbar { display: none; }

.rates-label {
  color: #64748b;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding-right: 18px;
  border-right: 1px solid var(--border-dark);
  margin-right: 18px;
  flex-shrink: 0;
}
.rate-item {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 0 16px;
  border-right: 1px solid var(--border-dark);
  flex-shrink: 0;
}
.rate-item:last-of-type { border-right: none; }
.rate-item .lbl { color: #94a3b8; font-size: 11px; }
.rate-item .val { font-weight: 700; color: #f8fafc; font-family: var(--mono); font-size: 12px; }
.rates-date { margin-left: auto; color: #475569; font-size: 11px; padding-left: 20px; flex-shrink: 0; }

/* ── Navigation ────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 30px;
  z-index: 39;
  border-bottom: 2px solid var(--accent);
  padding: 0 20px;
  display: flex;
  align-items: stretch;
  background: var(--bg);
}
.site-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  padding: 10px 20px 10px 0;
  border-right: 1px solid var(--border);
  margin-right: 4px;
  letter-spacing: -0.4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
nav a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  display: flex;
  align-items: center;
  transition: color .15s, border-color .15s;
}
nav a.active, nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
  position: sticky;
  top: 72px;
  z-index: 38;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(6px);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.page-meta  { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
/* ── Content Scaffolding / Accessibility ───────────────────── */
h1 {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}

h2 { font-size: 13px; }

.page-header.stacked {
  align-items: flex-start;
}

.page-header > div { max-width: 900px; }

.page-intro {
  max-width: 820px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 3px;
}

.guide-card {
  margin: 10px 12px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
}
.guide-card h2 {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}
.guide-card ul {
  margin-left: 18px;
  display: grid;
  gap: 5px;
}
.guide-card li { line-height: 1.45; }

caption {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 11px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

tbody th {
  padding: 3px 3px;
  text-align: right;
  white-space: nowrap;
  font-weight: 500;
}
tbody th.left { text-align: left; }
.ticker-cell { color: var(--text); }
.issuer-count {
  font-weight: 600;
  color: #64748b;
  margin-left: 6px;
  font-size: 11px;
}
.issuer-summary {
  display: grid;
  gap: 3px;
  padding: 3px 0;
}
.issuer-summary-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.issuer-symbol {
  color: #1e293b;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.issuer-name {
  color: #334155;
  font-weight: 700;
  letter-spacing: normal;
}
.issuer-meta {
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: normal;
}
.issuer-description {
  color: #64748b;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.45;
  max-width: 980px;
  white-space: normal;
}
.muted-status { color:#9ca3af;font-size:12px; }

@media (max-width: 720px) {
  body { font-size: 14px; }
  #rates-band { padding: 8px 12px; }
  nav { padding: 0 12px; overflow-x: auto; }
  .site-title { font-size: 14px; padding-right: 12px; }
  nav a { padding: 0 12px; min-height: 40px; }
  .page-header { padding: 16px 12px; }
  .search-box { width: 100%; font-size: 14px; }
  .guide-card { margin: 12px; }
  .section { padding: 16px 12px; }
  table { font-size: 9px; }
  thead th, tbody th, tbody td { padding-left: 3px; padding-right: 3px; }
}


.search-box {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font);
  width: 260px;
  outline: none;
}
.search-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ── Data Table ─────────────────────────────────────────────── */
.table-wrap { overflow-x: hidden; width: 100%; max-width: 100vw; }

table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: clamp(8px, 0.72vw, 11px); }

.col-ticker { width: 9%; }
.col-type { width: 11%; }
.col-price, .col-bid, .col-ask { width: 8%; }
.col-yield { width: 9%; }
.col-div { width: 11%; }
.col-div-date { width: 11%; }
.col-refresh { width: 10%; }

thead th {
  background: #293241;
  color: #cbd5e1;
  text-align: right;
  padding: 4px 3px;
  font-weight: 600;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.15;
  position: sticky;
  top: 0;
  z-index: 2;
}
thead th.left { text-align: left; }

tbody tr { border-bottom: 1px solid #f0f2f5; }
tbody tr.data-row:hover { background: var(--accent-dim); }

tbody td { padding: 3px 3px; text-align: right; white-space: normal; overflow-wrap: anywhere; }
tbody td.left { text-align: left; }

/* Issuer header rows */
tr.issuer-header th {
  position: sticky;
  top: 120px;
  z-index: 4;
  background: var(--issuer-bg);
  font-weight: 700;
  font-size: 11px;
  color: #475569;
  padding: 4px 5px;
  text-align: left;
  letter-spacing: 0.4px;
  border-top: 1px solid #dde3ea;
}
tr.issuer-header:first-child th { border-top: none; }

/* Number & blank helpers */
.num   { font-family: var(--mono); }
.blank { color: #d1d5db; }

/* Type badges */
.badge {
  display: inline-block;
  padding: 1px 3px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-rr { background: #dbeafe; color: #1e3a8a; }
.badge-fl { background: #dcfce7; color: #14532d; }
.badge-pp { background: #fef9c3; color: #713f12; }
.badge-uk { background: #f3f4f6; color: #4b5563; }

/* ── Loading / Error States ─────────────────────────────────── */
#status {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.err-title { color: var(--red); font-weight: 600; margin-bottom: 8px; }
.err-hint  { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ── Rate Cards (taux.html) ─────────────────────────────────── */
.section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.rate-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.rate-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  background: var(--bg);
}
.rate-card-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}
.rate-card-value {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--mono);
  color: var(--accent);
  letter-spacing: -1px;
}
.rate-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.4;
}

/* ── CORRA Chart Section ────────────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 300px;
  max-width: 860px;
}
.chart-sub { font-size: 11px; color: var(--text-muted); margin: 4px 0 16px; }

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  margin-top: 32px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Directory fixed-frame layout ─────────────────────────────
   Répertoire only: rates/nav/header/guide/footer stay in the static frame;
   the table body is the only vertical scrolling region. */
body.directory-page {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.directory-page #rates-band,
body.directory-page nav,
body.directory-page .page-header {
  position: static;
  flex: 0 0 auto;
}
body.directory-page .guide-card {
  flex: 0 0 auto;
}
body.directory-page .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}
body.directory-page footer {
  flex: 0 0 auto;
  margin-top: 0;
}
body.directory-page thead th {
  top: 0;
  z-index: 5;
}
body.directory-page tr.issuer-header th {
  top: 22px;
  z-index: 4;
}
body.directory-page table {
  min-width: 0;
}
@media (max-width: 720px) {
  body.directory-page .page-header { padding: 8px 10px; }
  body.directory-page .page-intro { display: none; }
  body.directory-page .guide-card { margin: 6px 8px; padding: 7px 8px; font-size: 12px; }
  body.directory-page tr.issuer-header th { top: 20px; }
}


/* ── Static Content Pages ───────────────────────────────────── */
.content-page {
  padding: 20px;
  max-width: 980px;
}
.content-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.content-card h2 {
  font-size: 15px;
  margin-bottom: 10px;
  color: var(--text);
}
.content-card p {
  color: var(--text-muted);
  line-height: 1.6;
}
.caution-card {
  border-color: #fed7aa;
  background: #fff7ed;
}
.content-list {
  margin-left: 18px;
  color: var(--text-muted);
  display: grid;
  gap: 8px;
  line-height: 1.55;
}
.definition-list {
  display: grid;
  gap: 10px;
}
.definition-list dt {
  font-weight: 800;
  color: var(--text);
}
.definition-list dd {
  color: var(--text-muted);
  line-height: 1.55;
  margin-left: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.definition-list dd:last-child { border-bottom: none; padding-bottom: 0; }
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.glossary-grid .content-card { margin-bottom: 0; }
@media (max-width: 720px) {
  .content-page { padding: 12px; }
  .content-card { padding: 14px; }
  .glossary-grid { grid-template-columns: 1fr; }
}

/* Final responsive overrides: keep after table/search rules so they win cascade order. */
@media (max-width: 720px) {
  nav { top: 31px; }
  .page-header { top: 72px; padding: 8px 10px; }
  .page-intro { display: none; }
  .search-box { width: 100%; font-size: 12px; }
  .guide-card { margin: 8px; padding: 8px; font-size: 12px; }
  table { font-size: 8px; }
  thead th, tbody th, tbody td { padding-left: 2px; padding-right: 2px; }
  tr.issuer-header th { top: 112px; }
  .issuer-description { font-size: 10px; }
  .badge { padding-left: 2px; padding-right: 2px; font-size: 8px; }
}
