/* ============================================================================
   detail.css — shared styles for the Article & Tier detail pages
   (extracted from ArticleDetails.razor / TierDetails.razor to remove duplication)
   Prefixes: .ad-* = article-specific, .td-* = tier/shared.
   ========================================================================== */

/* ── Layout (legacy, kept for safety) ── */
.td-layout { display: flex; height: calc(100vh - 102px); overflow: hidden; }
.td-sidebar { width: 280px; flex-shrink: 0; border-right: 1px solid var(--ct-border-color); overflow-y: auto; }
.td-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ── Avatars ── */
.td-avatar { width: 64px; height: 64px; border-radius: 16px; background: linear-gradient(135deg,#7b2ff7,#4a00c8); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 28px; font-weight: 700; }

/* ── Section labels ── */
.td-section-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #7b2ff7; margin-bottom: 8px; }

/* ── Solde grid / cards (Tier) ── */
.td-solde-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.td-solde-total { grid-column: 1 / -1; }
.td-solde-card { border-radius: 10px; padding: 10px 12px; border: 1px solid transparent; }
.td-solde-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .75; margin-bottom: 4px; display: flex; align-items: center; }
.td-solde-value { font-size: 14px; font-weight: 700; }
.td-currency { font-size: 10px; font-weight: 500; opacity: .7; margin-left: 2px; }
.td-solde-neutral { background: rgba(100,116,139,.08); border-color: rgba(100,116,139,.15); color: #475569; }
.td-solde-green { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.2); color: #16a34a; }
.td-solde-red { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.2); color: #dc2626; }
.td-solde-purple { background: rgba(123,47,247,.1); border-color: rgba(123,47,247,.2); color: #7b2ff7; }

/* Account section headers (Type == 0 dual block) */
.td-account-header { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; padding: 4px 10px; border-radius: 6px; display: inline-flex; align-items: center; }
.td-account-achat { background: rgba(59,130,246,.1); color: #1d4ed8; }
.td-account-vente { background: rgba(34,197,94,.1); color: #15803d; }

/* Side info row (Tier) */
.td-side-row { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 5px; color: var(--ct-body-color); }
.td-side-row i { margin-top: 0; width: 15px; text-align: center; color: #999; flex-shrink: 0; }

/* Contact rows */
.td-contact-row { padding: 6px 0; border-bottom: 1px dashed var(--ct-border-color); }
.td-contact-row:last-child { border-bottom: none; }

/* ── Custom tab bar (Tier) ── */
.td-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--ct-border-color); background: var(--ct-secondary-bg); flex-shrink: 0; overflow-x: auto; }
.td-tab { padding: 10px 18px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; background: transparent; border-bottom: 2px solid transparent; color: var(--ct-body-color); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.td-tab:hover { color: #7b2ff7; }
.td-tab--active { border-bottom-color: #7b2ff7; color: #7b2ff7; }
.td-tab .td-count { background: rgba(123,47,247,.15); color: #7b2ff7; border-radius: 10px; padding: 1px 7px; font-size: 10px; }

/* ── Filter bar / pills ── */
.td-filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--ct-border-color); background: var(--ct-secondary-bg); flex-shrink: 0; }
.td-filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.td-pill { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 12px; line-height: 1; font-size: 11px; font-weight: 600; border-radius: 20px; border: 1.5px solid var(--ct-border-color); background: transparent; cursor: pointer; white-space: nowrap; color: var(--ct-body-color); transition: all .15s; }
.td-pill:hover { border-color: #7b2ff7; color: #7b2ff7; }
.td-pill--active { background: #7b2ff7; border-color: #7b2ff7; color: #fff !important; }
.td-pill--danger { background: #dc2626; border-color: #dc2626; }
.td-pill--success { background: #16a34a; border-color: #16a34a; }

/* ── Tables ── */
.td-table-wrap { overflow-x: auto; }
.td-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.td-table th { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #999; padding: 8px 12px; border-bottom: 1px solid var(--ct-border-color); white-space: nowrap; background: var(--ct-secondary-bg); position: sticky; top: 0; z-index: 1; }
.td-table td { padding: 8px 12px; border-bottom: 1px solid var(--ct-border-color); vertical-align: middle; }
.td-table tfoot td { border-top: 2px solid var(--ct-border-color); border-bottom: none; font-weight: 700; background: var(--ct-secondary-bg); position: sticky; bottom: 0; }
.td-table tbody tr:hover { background: var(--ct-secondary-bg); }

/* Document type badges (Tier) */
.td-type-badge { font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; }
.td-achat-3 { background: #e3f2fd; color: #1565c0; }
.td-achat-4 { background: #e8f5e9; color: #2e7d32; }
.td-achat-5 { background: #fff3e0; color: #e65100; }
.td-vente-1 { background: #f3e8ff; color: #6b21a8; }
.td-vente-2 { background: #e3f2fd; color: #1565c0; }
.td-vente-4 { background: #e8f5e9; color: #2e7d32; }
.td-vente-5 { background: #fff3e0; color: #e65100; }

/* ── Relevé solde banners ── */
.td-releve-solde-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; background: rgba(123,47,247,.06); border-bottom: 1px solid rgba(123,47,247,.15); }
.td-releve-solde-final { border-bottom: none; border-top: 2px solid var(--ct-border-color); background: rgba(123,47,247,.04); }
.td-releve-solde-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #7b2ff7; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.td-releve-solde-value { font-size: 15px; font-weight: 700; }
.td-releve-impayer td { opacity: .55; }
.td-releve-impayer .fw-semibold, .td-releve-impayer .fw-bold { text-decoration: line-through; }

/* Movement type badges (Article relevé) */
.td-mouv-badge { font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; }
.td-mouv-entree { background: #e8f5e9; color: #2e7d32; }
.td-mouv-sortie { background: #fff3e0; color: #e65100; }
.td-mouv-casse { background: #fce4ec; color: #c62828; }
.td-mouv-consommer { background: #e3f2fd; color: #1565c0; }

/* ── Empty state ── */
.td-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px; color: #aaa; font-size: 13px; }

/* ── Utilities ── */
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-18 { font-size: 18px; }

/* ── KpiCard component (shared) ── */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.kpi-card { display: flex; align-items: center; gap: 10px; background: var(--ct-card-bg, var(--ct-secondary-bg)); border: 1px solid var(--ct-border-color); border-radius: 12px; padding: 12px 14px; }
.kpi-icon { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 19px; }
.kpi-purple { background: rgba(123,47,247,.12); color: #7b2ff7; }
.kpi-green  { background: rgba(34,197,94,.12);  color: #16a34a; }
.kpi-blue   { background: rgba(59,130,246,.12); color: #2563eb; }
.kpi-orange { background: rgba(249,115,22,.12); color: #ea580c; }
.kpi-red    { background: rgba(239,68,68,.14);  color: #dc2626; }
.kpi-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .6; }
.kpi-value { font-size: 17px; font-weight: 800; line-height: 1.1; }
.kpi-unit  { font-size: 10px; font-weight: 500; opacity: .6; margin-left: 2px; }

/* ── Credit limit bar ── */
.td-credit-head { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 4px; color: var(--ct-body-color); }
.td-credit-bar { height: 7px; background: var(--ct-secondary-bg); border-radius: 5px; overflow: hidden; }
.td-credit-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg,#7b2ff7,#a78bfa); transition: width .3s; }
.td-credit-over { background: linear-gradient(90deg,#dc2626,#f87171); }
.td-credit-warn { font-size: 10px; font-weight: 700; color: #dc2626; margin-top: 4px; }

/* ── Risk chips ── */
.td-risk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.td-risk-chip { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px; display: inline-flex; align-items: center; }
.td-risk-warn   { background: rgba(251,191,36,.18);  color: #b45309; }
.td-risk-danger { background: rgba(239,68,68,.16);   color: #dc2626; }
.td-risk-muted  { background: rgba(100,116,139,.14); color: #475569; }
.td-risk-impaye { background: #dc2626;               color: #fff; }

/* ── Contact actions ── */
.td-contact-action { color: var(--ct-body-color); text-decoration: none; }
.td-contact-action:hover { color: #7b2ff7; text-decoration: underline; }
.td-action-link { display: inline-flex; align-items: center; justify-content: center; color: #7b2ff7; text-decoration: none; }
.td-action-link:hover { opacity: .75; }
.td-wa { color: #25d366; }
.td-copy-btn { background: transparent; border: none; color: #7b2ff7; cursor: pointer; padding: 0 2px; font-size: 12px; line-height: 1; }
.td-copy-btn:hover { opacity: .7; }

/* ── Row action icon buttons ── */
.td-icon-btn { background: transparent; border: none; color: var(--ct-body-color); cursor: pointer; padding: 2px 6px; font-size: 15px; line-height: 1; border-radius: 6px; }
.td-icon-btn:hover { background: var(--ct-secondary-bg); color: #7b2ff7; }
.td-icon-btn.text-danger:hover { color: #dc2626; }

/* ── Balance âgée (aging) ── */
.td-aging-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 768px) { .td-aging-grid { grid-template-columns: repeat(2, 1fr); } }
.td-aging-card { border-radius: 10px; padding: 12px 14px; border: 1px solid transparent; }
.td-aging-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .8; }
.td-aging-amount { font-size: 18px; font-weight: 800; margin-top: 2px; }
.td-aging-count { font-size: 10px; opacity: .65; margin-top: 2px; }
.td-aging-0 { background: rgba(34,197,94,.10);  border-color: rgba(34,197,94,.25);  color: #15803d; }
.td-aging-1 { background: rgba(234,179,8,.12);  border-color: rgba(234,179,8,.28);  color: #a16207; }
.td-aging-2 { background: rgba(249,115,22,.12); border-color: rgba(249,115,22,.28); color: #c2410c; }
.td-aging-3 { background: rgba(239,68,68,.12);  border-color: rgba(239,68,68,.30);  color: #dc2626; }
.td-aging-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 12px; }

/* ── Timeline badges ── */
.td-tl-achat  { background: #e3f2fd; color: #1565c0; }
.td-tl-vente  { background: #e8f5e9; color: #2e7d32; }
.td-tl-rgl    { background: #ede7f6; color: #6b21a8; }
.td-tl-retour { background: #fff3e0; color: #e65100; }

/* ============================================================================
   Article-specific (.ad-*)
   ========================================================================== */

/* Sidebar header */
.ad-sidebar-header { background: linear-gradient(135deg, #7b2ff7 0%, #4a00c8 100%); padding: 28px 20px 22px; text-align: center; }
.ad-avatar { width: 64px; height: 64px; border-radius: 18px; background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.35); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 26px; font-weight: 800; box-shadow: 0 4px 16px rgba(0,0,0,.18); }

/* Reference badge + copy */
.ad-ref-badge { display: inline-block; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); color: rgba(255,255,255,.9); border-radius: 20px; padding: 2px 12px; font-size: 11px; font-weight: 600; letter-spacing: .04em; margin-top: 4px; }
.ad-ref-wrap { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
.ad-copy-btn { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 6px; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; transition: background .15s; }
.ad-copy-btn:hover { background: rgba(255,255,255,.3); }
.ad-article-switcher { display: flex; align-items: center; gap: 6px; margin: 12px auto 4px; padding: 6px; border-radius: 8px; background: transparent; border: 1px solid rgba(255,255,255,.25); }
.ad-article-switcher .rz-dropdown { min-height: 30px; border: 0; background: transparent; box-shadow: none; }
.ad-article-switcher .rz-dropdown,
.ad-article-switcher .rz-dropdown-label,
.ad-article-switcher .rz-placeholder { color: #fff; }
.ad-article-switcher .rz-dropdown-trigger,
.ad-article-switcher .rz-dropdown-trigger-icon,
.ad-article-switcher .rz-icon { color: #fff; }
.ad-article-switcher .rz-dropdown:not(.rz-state-disabled):hover,
.ad-article-switcher .rz-dropdown:not(.rz-state-disabled):focus,
.ad-article-switcher .rz-dropdown.rz-state-focused { background: rgba(255,255,255,.08); box-shadow: none; }

/* Status badges */
.ad-status-badge { font-size: 10px; font-weight: 800; padding: 4px 11px; border-radius: 20px; display: inline-flex; align-items: center; letter-spacing: .03em; }
.ad-badge-achat  { background: rgba(255,255,255,.15);  color: #fff;     border: 1px solid rgba(255,255,255,.35); }
.ad-badge-vente  { background: rgba(74,222,128,.25);   color: #86efac;  border: 1px solid rgba(74,222,128,.45); }
.ad-badge-stock  { background: rgba(251,191,36,.25);   color: #fde68a;  border: 1px solid rgba(251,191,36,.45); }
.ad-badge-composer { background: rgba(168,139,250,.25); color: #ede9fe; border: 1px solid rgba(168,139,250,.45); }
.ad-badge-inactive { background: rgba(239,68,68,.25);   color: #fecaca; border: 1px solid rgba(239,68,68,.45); }
.ad-cat-badge { font-size: 9px; font-weight: 700; padding: 3px 9px; border-radius: 20px; display: inline-flex; align-items: center; letter-spacing: .03em; background: rgba(255,255,255,.12); color: rgba(255,255,255,.92); border: 1px solid rgba(255,255,255,.22); }

/* Edit button */
.ad-edit-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: rgba(255,255,255,.15); border: 1.5px solid rgba(255,255,255,.35); color: #fff; border-radius: 8px; padding: 7px 18px; font-size: 12px; font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s; width: 100%; }
.ad-edit-btn:hover { background: rgba(255,255,255,.28); border-color: rgba(255,255,255,.6); }

/* Sidebar sections */
.ad-sidebar-section { padding: 14px 16px; border-bottom: 1px solid var(--ct-border-color); }
.ad-sidebar-section:last-child { border-bottom: none; }
.ad-section-label { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #7b2ff7; margin-bottom: 10px; display: flex; align-items: center; }

/* Info rows */
.ad-side-row { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; margin-bottom: 6px; color: var(--ct-body-color); }
.ad-side-row i          { color: #a78bfa; flex-shrink: 0; margin-top: 1px; font-size: 13px; }
.ad-row-label           { font-weight: 600; min-width: 72px; color: #6b7280; font-size: 11px; }
.ad-row-value           { color: var(--ct-body-color); }
.ad-side-remark         { align-items: flex-start; padding: 6px 8px; background: var(--ct-secondary-bg); border-radius: 6px; margin-top: 4px; }

/* Price grid */
.ad-price-grid          { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 8px; }
.ad-price-card          { border-radius: 10px; padding: 10px 12px; border: 1px solid transparent; }
.ad-price-label         { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .7; margin-bottom: 3px; }
.ad-price-value         { font-size: 13px; font-weight: 700; }
.ad-currency            { font-size: 10px; font-weight: 500; opacity: .65; margin-left: 2px; }
.ad-price-achat         { background: rgba(59,130,246,.08);  border-color: rgba(59,130,246,.2);  color: #1d4ed8; }
.ad-price-dernier-achat { background: rgba(14,165,233,.08);  border-color: rgba(14,165,233,.22);  color: #0369a1; }
.ad-price-vente         { background: rgba(34,197,94,.08);   border-color: rgba(34,197,94,.2);   color: #15803d; }
.ad-price-ttc           { font-size: 10px; font-weight: 600; opacity: .6; margin-top: 2px; }

/* Margin bar */
.ad-margin-bar { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; }
.ad-margin-item { flex: 1; text-align: center; background: var(--ct-secondary-bg); border-radius: 8px; padding: 6px 4px; }
.ad-margin-label { display: block; font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .6; }
.ad-margin-value { display: block; font-size: 12px; font-weight: 800; margin-top: 2px; }

/* Pricing insights */
.ad-pmp-tag { font-size: 7px; font-weight: 800; letter-spacing: .04em; background: rgba(59,130,246,.18); color: #1d4ed8; border-radius: 4px; padding: 1px 4px; vertical-align: middle; margin-left: 3px; }
.ad-price-insights { margin-top: 10px; border-top: 1px dashed var(--ct-border-color); padding-top: 8px; }
.ad-insight-row { display: flex; align-items: center; justify-content: space-between; font-size: 11px; padding: 3px 0; }
.ad-insight-label { color: #6b7280; font-weight: 600; display: flex; align-items: center; }
.ad-insight-label i { color: #a78bfa; }
.ad-insight-value { font-weight: 700; }
.ad-insight-sub { font-size: 9px; font-weight: 500; opacity: .6; margin-left: 4px; }
.ad-insight-meta { font-size: 10px; color: #6b7280; font-style: italic; padding: 0 0 4px 2px; }

/* Stock summary cards */
.ad-stock-grid          { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.ad-stock-card          { border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid transparent; }
.ad-stock-icon          { font-size: 20px; flex-shrink: 0; opacity: .7; }
.ad-stock-label         { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .65; margin-bottom: 2px; }
.ad-stock-value         { font-size: 14px; font-weight: 800; }
.ad-stock-main          { background: rgba(123,47,247,.08); border-color: rgba(123,47,247,.2); color: #7b2ff7; grid-column: 1 / -1; }
.ad-stock-neutral       { background: rgba(100,116,139,.07); border-color: rgba(100,116,139,.15); color: #475569; }
.ad-stock-dispo         { background: rgba(34,197,94,.08);  border-color: rgba(34,197,94,.2);  color: #15803d; }
.ad-stock-proj          { background: rgba(59,130,246,.08); border-color: rgba(59,130,246,.2); color: #1d4ed8; }

/* Stock detail rows */
.ad-stock-details       { display: flex; flex-direction: column; gap: 4px; }
.ad-stock-detail-row    { display: flex; align-items: center; justify-content: space-between; font-size: 11px; padding: 3px 0; border-bottom: 1px dashed var(--ct-border-color); }
.ad-stock-detail-row:last-child { border-bottom: none; }
.ad-stock-detail-label  { display: flex; align-items: center; gap: 5px; color: #6b7280; font-weight: 500; }
.ad-stock-detail-label i { font-size: 12px; }
.ad-stock-detail-value  { font-weight: 700; }

/* Low-stock alert */
.ad-alert-lowstock { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25); color: #b91c1c; }
.ad-alert-lowstock > i { font-size: 24px; flex-shrink: 0; }

/* Tab counters (Article — Bootstrap nav-tabs) */
.ad-tab-count { display: inline-block; background: rgba(123,47,247,.15); color: #7b2ff7; border-radius: 10px; padding: 0 7px; font-size: 10px; font-weight: 700; margin-left: 4px; }
.nav-link.active .ad-tab-count { background: rgba(255,255,255,.92); color: #7b2ff7; }

/* Caisse remaining bar */
.ad-caisse-progress { height: 5px; background: var(--ct-secondary-bg); border-radius: 4px; overflow: hidden; margin-bottom: 3px; }
.ad-caisse-progress-bar { height: 100%; background: linear-gradient(90deg,#7b2ff7,#a78bfa); border-radius: 4px; }

/* Movement type summary chips */
.ad-mouv-summary { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--ct-border-color); }
.ad-mouv-chip { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; display: inline-flex; align-items: center; gap: 6px; }
.ad-mouv-chip-n { background: rgba(0,0,0,.08); border-radius: 10px; padding: 0 6px; font-size: 9px; font-weight: 700; }
.td-mouv-retour-achat,
.td-mouv-regularisation-sortie,
.td-mouv-transfert-sortie { background: #fff7ed; color: #c2410c; }
.td-mouv-retour-vente,
.td-mouv-regularisation-entree,
.td-mouv-transfert-entree { background: #ecfdf5; color: #047857; }
.ad-separated-panel { display: flex; flex-direction: column; min-height: 520px; background: var(--ct-card-bg); border: 1px solid var(--ct-border-color); border-radius: 8px; overflow: hidden; }
.ad-separated-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--ct-border-color); background: var(--ct-secondary-bg); }
.ad-separated-header h6 { font-weight: 800; color: var(--ct-heading-color); }
.ad-separated-table { flex: 1; min-height: 360px; }
