/* ============================================================
   COMPTA TACTICAL - Dashboard militaire
   ============================================================ */

:root {
    --bg-deep:        #0d0f08;
    --bg-canvas:      #181a10;
    --bg-card:        #1f2317;
    --bg-card-hover:  #262b1c;
    --border:         #3a4126;
    --border-bright:  #5b6735;

    --olive:          #6b7a3e;
    --olive-bright:   #8a9b50;
    --khaki:          #a8a060;
    --sand:           #c4b890;
    --rust:           #8b3a1f;
    --rust-bright:    #c44d28;
    --blood:          #6b1818;
    --gold:           #d4af37;

    --text:           #d8d4b6;
    --text-dim:       #8a8770;
    --text-bright:    #efe9c8;
    --text-alert:     #ff6b35;
    --text-ok:        #7fb851;

    --font-mono:      'JetBrains Mono', 'Courier New', monospace;
    --font-stencil:   'Stardos Stencil', 'Arial Black', sans-serif;
    --font-body:      'Inter', 'Segoe UI', sans-serif;
}

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

html, body {
    background: var(--bg-deep);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Texture bruit subtile sur toute la page */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(107,122,62,0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139,58,31,0.03) 0%, transparent 50%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    pointer-events: none;
    z-index: 0;
}

/* Scanlines CRT subtiles */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0,0,0,0) 0px,
        rgba(0,0,0,0) 2px,
        rgba(0,0,0,0.06) 3px,
        rgba(0,0,0,0) 4px
    );
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: multiply;
}

main, header, footer, .wrap { position: relative; z-index: 2; }

/* ============================================================
   HEADER
   ============================================================ */
.header {
    background: linear-gradient(180deg, #11140a 0%, #181b10 100%);
    border-bottom: 1px solid var(--border);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--olive-bright), transparent);
}

.header-left {
    display: flex; align-items: center; gap: 16px;
}

.logo-block {
    display: flex; align-items: center; gap: 12px;
}

.logo-mark {
    width: 42px; height: 42px;
    border: 2px solid var(--khaki);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-deep);
    font-family: var(--font-stencil);
    font-size: 22px;
    color: var(--khaki);
    transform: rotate(-3deg);
    box-shadow: 0 0 0 1px var(--bg-deep), 0 0 0 2px var(--khaki);
}

.logo-text h1 {
    font-family: var(--font-stencil);
    font-size: 22px;
    font-weight: 400;
    color: var(--text-bright);
    letter-spacing: 3px;
    line-height: 1;
}

.logo-text .subtitle {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 2px;
    margin-top: 4px;
    text-transform: uppercase;
}

.header-right {
    display: flex; align-items: center; gap: 24px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.status-indicator {
    display: flex; align-items: center; gap: 8px;
}

.dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-ok);
    box-shadow: 0 0 10px var(--text-ok);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============================================================
   STAMP "CONFIDENTIEL"
   ============================================================ */
.stamp {
    position: absolute;
    top: 20px;
    right: 32px;
    color: var(--rust-bright);
    border: 3px double var(--rust-bright);
    padding: 6px 16px;
    font-family: var(--font-stencil);
    font-size: 14px;
    letter-spacing: 4px;
    transform: rotate(-12deg);
    opacity: 0.65;
    pointer-events: none;
    text-shadow: 0 0 5px rgba(196,77,40,0.3);
    z-index: 100;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
}

.page-title {
    font-family: var(--font-stencil);
    font-size: 32px;
    color: var(--text-bright);
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.page-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 32px;
}

.page-meta::before {
    content: '// ';
    color: var(--olive-bright);
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--khaki);
    padding: 16px 20px;
    margin-bottom: 28px;
    display: flex;
    gap: 24px;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 12px;
    flex-wrap: wrap;
}

.filter-bar label {
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-right: 8px;
}

.filter-bar select, .filter-bar input {
    background: var(--bg-deep);
    color: var(--text-bright);
    border: 1px solid var(--border-bright);
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
}

.filter-bar select:focus, .filter-bar input:focus {
    outline: none;
    border-color: var(--khaki);
    box-shadow: 0 0 0 2px rgba(168,160,96,0.2);
}

.filter-bar .btn {
    background: var(--olive);
    color: var(--text-bright);
    border: 1px solid var(--olive-bright);
    padding: 6px 18px;
    font-family: var(--font-stencil);
    font-size: 12px;
    letter-spacing: 2px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.15s;
}

.filter-bar .btn:hover {
    background: var(--olive-bright);
    box-shadow: 0 0 15px rgba(138,155,80,0.4);
}

/* ============================================================
   KPI GRID
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
    animation: slideUp 0.4s ease-out backwards;
}

.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.1s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.2s; }
.kpi-card:nth-child(5) { animation-delay: 0.25s; }
.kpi-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

.kpi-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-bright);
    transform: translateY(-2px);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: var(--olive);
}

.kpi-card.alert::before { background: var(--rust-bright); }
.kpi-card.ok::before    { background: var(--text-ok); }
.kpi-card.warn::before  { background: var(--khaki); }

.kpi-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.kpi-value {
    font-family: var(--font-stencil);
    font-size: 32px;
    color: var(--text-bright);
    line-height: 1;
    letter-spacing: 1px;
}

.kpi-card.alert .kpi-value { color: var(--text-alert); }
.kpi-card.ok    .kpi-value { color: var(--text-ok); }

.kpi-unit {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-dim);
    margin-left: 4px;
    letter-spacing: 1px;
}

.kpi-delta {
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}

.kpi-delta.up   { color: var(--text-ok); }
.kpi-delta.down { color: var(--text-alert); }

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

.section-header {
    background: linear-gradient(180deg, #1c1f14 0%, #181b10 100%);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    font-family: var(--font-stencil);
    font-size: 14px;
    color: var(--khaki);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.section-title::before {
    content: '[';
    color: var(--olive-bright);
    margin-right: 6px;
}
.section-title::after {
    content: ']';
    color: var(--olive-bright);
    margin-left: 6px;
}

.section-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.section-body {
    padding: 20px;
}

/* ============================================================
   TABLE
   ============================================================ */
table.tactical {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 12px;
}

table.tactical thead th {
    background: var(--bg-deep);
    color: var(--khaki);
    text-align: left;
    padding: 10px 14px;
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-bright);
    font-weight: 400;
}

table.tactical tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(58,65,38,0.5);
    color: var(--text);
}

table.tactical tbody tr {
    transition: background 0.1s;
}

table.tactical tbody tr:hover {
    background: rgba(107,122,62,0.08);
}

table.tactical tbody tr.alert {
    background: rgba(139,58,31,0.08);
}

table.tactical tbody tr.alert:hover {
    background: rgba(139,58,31,0.15);
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-bright);
}

.num.bad  { color: var(--text-alert); font-weight: bold; }
.num.good { color: var(--text-ok); }

.tag {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--border-bright);
    background: var(--bg-deep);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.tag.cpc     { color: var(--gold); border-color: var(--gold); }
.tag.refund  { color: var(--text-alert); border-color: var(--rust); }
.tag.paid    { color: var(--text-ok); border-color: var(--olive-bright); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    text-align: center;
    padding: 24px;
    margin-top: 48px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    border-top: 1px solid var(--border);
}

.footer::before {
    content: '— ';
}
.footer::after {
    content: ' —';
}

/* ============================================================
   ASCII DECORATIONS
   ============================================================ */
.ascii-divider {
    font-family: var(--font-mono);
    color: var(--olive);
    font-size: 11px;
    text-align: center;
    margin: 24px 0;
    letter-spacing: 2px;
    user-select: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .wrap { padding: 16px; }
    .header { padding: 12px 16px; flex-direction: column; gap: 12px; align-items: flex-start; }
    .stamp { top: 8px; right: 8px; font-size: 11px; padding: 4px 10px; }
    .page-title { font-size: 22px; }
    .kpi-value { font-size: 24px; }
    table.tactical { font-size: 11px; }
}
