/* Couleurs reprises de l'Activité Teddy Rush (activity/public/style.css). */
:root {
    --bg: #fbeef2;
    --bg-2: #f6dde5;
    --panel: #fffaf6;
    --ink: #5a2f24;
    --ink-soft: #8d6157;
    --pink: #e0658f;
    --pink-soft: #f7c5d6;
    --gold: #d4a017;
    --coffee: #a8754f;
    --mint: #3fae7a;
    --red: #d9534f;
    --grey: #9a8a86;
    --line: #ecc7d3;
    --radius: 14px;
    --console-bg: #2b1d19;
    --console-ink: #f3e6df;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: radial-gradient(circle at 20% 0%, #fff6f9 0%, var(--bg) 45%, var(--bg-2) 100%) fixed;
    color: var(--ink);
    font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

[hidden] { display: none !important; }

button, input { font: inherit; color: inherit; }
code { background: var(--pink-soft); padding: 1px 6px; border-radius: 6px; }
h1, h2, h3 { margin: 0; }
h2 { font-size: 1.2rem; margin-bottom: 12px; }
h3 { font-size: 1rem; margin-bottom: 12px; }
.muted { color: var(--ink-soft); font-size: .9rem; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 4px 18px rgba(160, 80, 100, .08);
    min-width: 0;
}

/* Boutons */
.btn {
    border: none;
    border-radius: 10px;
    padding: 9px 16px;
    cursor: pointer;
    font-weight: bold;
    transition: filter .15s, opacity .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.07); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--pink); color: #fff; }
.btn-start { background: var(--mint); color: #fff; }
.btn-stop { background: var(--red); color: #fff; }
.btn-restart { background: var(--gold); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--pink-soft); }
.btn-sm { padding: 5px 10px; font-size: .85rem; }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.login-card label { text-align: left; font-weight: bold; margin-top: 8px; }
.login-card input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
}
.login-card input:focus { outline: 2px solid var(--pink); border-color: transparent; }
.logo { font-size: 3rem; }
.error { color: var(--red); min-height: 1.2em; margin: 0; }
.hint { font-size: .85rem; color: var(--ink-soft); margin: 0; }

/* Barre du haut */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 2;
}
.brand { font-weight: bold; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.logo-sm { font-size: 1.4rem; }
.badge { background: var(--gold); color: #fff; font-size: .75rem; padding: 2px 8px; border-radius: 99px; }

.content { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 28px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { margin: 0; }

.banner { background: #fde3e2; border: 1px solid #f3b4b2; color: #8a2b28; padding: 10px 14px; border-radius: 10px; margin: 0; }

/* Cartes processus */
.proc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.proc-title { font-weight: bold; font-size: 1.05rem; }
.proc-name { font-family: Consolas, monospace; font-size: .85rem; color: var(--ink-soft); }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: bold; font-size: .85rem; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status.online { color: var(--mint); background: #e3f5ec; }
.status.online::before { animation: pulse 1.6s infinite; }
.status.stopped { color: var(--grey); background: #efe9e7; }
.status.errored, .status.missing { color: var(--red); background: #fde3e2; }
.status.busy { color: var(--gold); background: #fbf0cf; }
@keyframes pulse { 50% { opacity: .35; } }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.stat-label { font-size: .78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 1.15rem; font-weight: bold; font-variant-numeric: tabular-nums; }
.proc-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.proc-actions .btn { flex: 1; }

/* Onglets */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 99px;
    padding: 6px 14px;
    cursor: pointer;
}
.tab.active { background: var(--pink); border-color: var(--pink); color: #fff; }
.tabs.small .tab { padding: 4px 12px; font-size: .9rem; }
.count { background: var(--red); color: #fff; border-radius: 99px; padding: 0 7px; font-size: .75rem; margin-left: 4px; }

/* Logs */
.logs-card { padding: 0; overflow: hidden; }
.logs-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.logs-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 6px; font-size: .9rem; cursor: pointer; }
.log-box {
    margin: 0;
    height: 420px;
    overflow: auto;
    background: var(--console-bg);
    color: var(--console-ink);
    font: 13px/1.5 Consolas, "Cascadia Mono", monospace;
    padding: 12px 14px;
    white-space: pre-wrap;
    word-break: break-word;
}
.log-box .err { color: #ff9b95; }
.log-box .sys { color: #c9a98f; font-style: italic; }

/* Données */
.table { width: 100%; border-collapse: collapse; }
.table td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: none; }
.table td.qty { text-align: right; font-weight: bold; font-variant-numeric: tabular-nums; }
.table td.qty.zero { color: var(--red); }
.order { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; margin-bottom: 8px; }
.order-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; font-weight: bold; margin-bottom: 4px; }
.order-head span { white-space: nowrap; }
.order-items { font-size: .9rem; color: var(--ink-soft); }
.empty { color: var(--ink-soft); font-style: italic; margin: 0; }

@media (max-width: 600px) {
    .topbar { padding: 10px 16px; }
    .topbar .btn { padding: 6px 10px; font-size: .85rem; }
    .brand { font-size: 1rem; }
    .grid, .grid-3 { grid-template-columns: 1fr; }
    .log-box { height: 320px; }
}
