/* Console Kamel Digital — système de styles monochrome, d'inspiration shadcn/ui.
   Aucune couleur : l'état se lit à la forme, au remplissage et au contraste.
   Aucun webfont : pile système, pour ne dépendre d'aucun réseau tiers. */

:root {
    --background: #ffffff;
    --foreground: #0a0a0a;
    --card: #ffffff;
    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --border: #e4e4e7;
    --input: #e4e4e7;
    --primary: #18181b;
    --primary-foreground: #fafafa;
    --accent: #f4f4f5;
    --ring: #a1a1aa;
    --radius: .5rem;

    --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --background: #09090b;
        --foreground: #fafafa;
        --card: #0c0c0f;
        --muted: #18181b;
        --muted-foreground: #a1a1aa;
        --border: #26262a;
        --input: #26262a;
        --primary: #fafafa;
        --primary-foreground: #18181b;
        --accent: #1c1c20;
        --ring: #52525b;
    }
}

:root[data-theme="dark"] {
    --background: #09090b;
    --foreground: #fafafa;
    --card: #0c0c0f;
    --muted: #18181b;
    --muted-foreground: #a1a1aa;
    --border: #26262a;
    --input: #26262a;
    --primary: #fafafa;
    --primary-foreground: #18181b;
    --accent: #1c1c20;
    --ring: #52525b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--background);
    color: var(--foreground);
    font: 14px/1.55 var(--sans);
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- structure */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 244px; flex: none;
    border-right: 1px solid var(--border);
    background: var(--card);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}

.sidebar-brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.15rem 1.1rem; border-bottom: 1px solid var(--border);
    color: var(--foreground); text-decoration: none;
    font-weight: 600; letter-spacing: -.01em;
}
.sidebar-brand svg { width: 22px; height: 22px; flex: none; }
.sidebar-brand small {
    display: block; font-weight: 400; font-size: .72rem;
    color: var(--muted-foreground); letter-spacing: 0;
}

.sidebar-nav { padding: .75rem .6rem; display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.sidebar-nav .group {
    font-size: .69rem; text-transform: uppercase; letter-spacing: .09em;
    color: var(--muted-foreground); padding: .7rem .5rem .3rem;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: .6rem;
    padding: .48rem .5rem; border-radius: calc(var(--radius) - 2px);
    color: var(--muted-foreground); text-decoration: none; font-size: .875rem;
}
.sidebar-nav a:hover { background: var(--accent); color: var(--foreground); }
.sidebar-nav a.on { background: var(--accent); color: var(--foreground); font-weight: 500; }
.sidebar-nav a svg { width: 16px; height: 16px; flex: none; opacity: .8; }

.sidebar-foot {
    border-top: 1px solid var(--border); padding: .8rem 1.1rem;
    display: flex; align-items: center; gap: .6rem;
}
.avatar {
    width: 28px; height: 28px; border-radius: 99px; flex: none;
    background: var(--primary); color: var(--primary-foreground);
    display: grid; place-items: center; font-size: .74rem; font-weight: 600;
}
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who b { display: block; font-size: .82rem; font-weight: 500; }
.sidebar-foot .who span { display: block; font-size: .72rem; color: var(--muted-foreground); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    border-bottom: 1px solid var(--border);
    padding: 0 1.6rem; height: 56px;
    display: flex; align-items: center; gap: 1rem;
    background: var(--background); position: sticky; top: 0; z-index: 4;
}
.topbar h1 { font-size: .95rem; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }

.page { padding: 1.6rem; display: flex; flex-direction: column; gap: 1.5rem; }

@media (max-width: 820px) {
    .shell { flex-direction: column; }
    .sidebar { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-nav .group { display: none; }
}

/* ------------------------------------------------------------- composants */

.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius);
}
.card-head { padding: 1.1rem 1.25rem .6rem; }
.card-title { font-size: .95rem; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.card-desc { font-size: .82rem; color: var(--muted-foreground); margin: .2rem 0 0; }
.card-body { padding: 1.25rem; }
.card-body.tight { padding: 0; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.metric { padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .35rem; }
.metric .label {
    font-size: .78rem; color: var(--muted-foreground);
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.metric .value { font-size: 1.75rem; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.metric .value small { font-size: .95rem; font-weight: 400; color: var(--muted-foreground); letter-spacing: 0; }
.metric .hint { font-size: .77rem; color: var(--muted-foreground); }

.bar { height: 6px; background: var(--muted); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); }
.bar.striped > i {
    background-image: repeating-linear-gradient(45deg,
        var(--primary) 0 4px, transparent 4px 8px);
    background-color: var(--muted-foreground);
}

.btn {
    font: inherit; font-size: .845rem; font-weight: 500;
    padding: .42rem .8rem; border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--border); background: var(--card); color: var(--foreground);
    cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem;
    white-space: nowrap;
}
.btn:hover { background: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.btn-primary:hover { opacity: .9; background: var(--primary); }
.btn-sm { font-size: .8rem; padding: .3rem .6rem; }

label.field { display: flex; flex-direction: column; gap: .35rem; }
label.field > span { font-size: .82rem; font-weight: 500; }
.input {
    font: inherit; font-size: .875rem; padding: .5rem .7rem;
    border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px);
    background: var(--background); color: var(--foreground); width: 100%;
}
.input:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; border-color: var(--ring); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.err { font-size: .8rem; color: var(--foreground); font-weight: 500; }

.badge {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .72rem; font-weight: 500; padding: .16rem .5rem;
    border-radius: 99px; border: 1px solid var(--border); white-space: nowrap;
}
.badge.solid { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.badge .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge.hollow .dot { background: transparent; border: 1px solid currentColor; }

table { border-collapse: collapse; width: 100%; font-size: .865rem; }
.tablewrap { overflow-x: auto; }
thead th {
    text-align: left; font-size: .73rem; font-weight: 500; text-transform: uppercase;
    letter-spacing: .06em; color: var(--muted-foreground);
    padding: .6rem 1.25rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: .65rem 1.25rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--muted); }
td.mono, .mono { font-family: var(--mono); font-size: .95em; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted-foreground); }

.alert {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: .85rem 1.1rem; font-size: .87rem; background: var(--card);
}
.alert.strong { border-color: var(--foreground); }
.alert ul { margin: .4rem 0 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .25rem; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.steps li { display: flex; gap: .6rem; align-items: flex-start; font-size: .875rem; }
.steps .mark {
    width: 17px; height: 17px; border-radius: 99px; flex: none; margin-top: .15rem;
    display: grid; place-items: center; font-size: .62rem; font-weight: 700;
    border: 1px solid var(--foreground);
}
.steps .mark.ok { background: var(--foreground); color: var(--background); }
.steps .detail { display: block; font-size: .8rem; color: var(--muted-foreground); }

.secret {
    background: var(--muted); border-radius: calc(var(--radius) - 2px); padding: .9rem 1rem;
}
.secret .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-foreground); }
.secret .v { font-family: var(--mono); font-size: 1.05rem; margin-top: .25rem; word-break: break-all; }

.prose { max-width: 68ch; color: var(--muted-foreground); font-size: .875rem; }

/* ------------------------------------------------------------- graphiques */
/* Monochrome assumé : les séries se distinguent par l'opacité et le tracé,
   jamais par la teinte — c'est aussi ce qui les rend lisibles à l'impression. */

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.chart-wrap { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.donut { flex: none; }
.donut circle { transition: none; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; font-size: .83rem; }
.legend li { display: flex; align-items: center; gap: .55rem; }
.legend .swatch {
    width: 11px; height: 11px; border-radius: 3px; flex: none;
    background: var(--foreground); border: 1px solid var(--foreground);
}
.legend .n { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: auto; padding-left: 1rem; }
.spark { width: 100%; height: auto; display: block; overflow: visible; }
.spark .grid { stroke: var(--border); stroke-width: 1; }
.spark .area { fill: var(--foreground); opacity: .07; }
.spark .line { fill: none; stroke: var(--foreground); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark .pt { fill: var(--background); stroke: var(--foreground); stroke-width: 1.75; }
.spark .lbl { fill: var(--muted-foreground); font-size: 9px; font-family: var(--sans); }
.chart-empty { color: var(--muted-foreground); font-size: .85rem; padding: 1.5rem 0; text-align: center; }
