/* Compléments au design system admin.css (icônes, états serveurs, temps réel) */
.hidden { display: none !important; }

/* ---- Menu latéral avec icônes ---- */
.sidebar-link {
    display: flex !important;
    align-items: center;
    gap: 12px;
}
.sidebar-link .ico {
    width: 18px; height: 18px; flex: 0 0 18px;
    fill: none; stroke: currentColor; stroke-width: 1.9;
    stroke-linecap: round; stroke-linejoin: round;
    opacity: .85;
}
.sidebar-link.active .ico { opacity: 1; }
.sidebar-footer { margin-top: auto; padding: 16px 0 0; border-top: 1px solid rgba(255,255,255,.08); }

.ico-btn { display: inline-flex; align-items: center; gap: 8px; }
.ico-btn .ico, .btn .ico, .icon-btn .ico {
    width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
}
.icon-btn .ico { width: 18px; height: 18px; }

/* ---- État des serveurs ---- */
.state {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 12px; border-radius: 100px; font-size: 12px; font-weight: 600;
}
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state-active   { background: var(--success-bg); color: var(--success); }
.state-active::before { animation: pulse 2s infinite; }
.state-down     { background: var(--error-bg);   color: var(--error); }
.state-pending  { background: var(--warning-bg); color: var(--warning); }
.state-disabled { background: var(--bg-tertiary); color: var(--text-tertiary); }

.row-actions { display: inline-flex; gap: 6px; }
.row-actions .icon-btn { width: 32px; height: 32px; }
.row-actions .danger:hover { color: var(--error); border-color: var(--error); }

/* ---- Ventes ---- */
.live-badge {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
    color: var(--success); background: var(--success-bg); padding: 4px 10px; border-radius: 100px;
}
.live-badge.off { color: var(--text-tertiary); background: var(--bg-tertiary); }
.live-badge .live-dot { margin: 0; }
.live-badge.off .live-dot { background: var(--text-tertiary); animation: none; }

.filters label.field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-secondary); font-weight: 600; }
.filters label.field .form-input { max-width: 190px; }
.filters .grow { flex: 1 1 220px; max-width: none; }
.totals-bar { display: flex; flex-wrap: wrap; gap: 24px; margin: 4px 0 16px; color: var(--text-secondary); }
.totals-bar strong { color: var(--text-primary); font-size: 16px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; color: var(--text-secondary); }
.pager .btn[disabled] { opacity: .45; cursor: not-allowed; }
tr.flash td { animation: flash 2.4s ease-out; }
@keyframes flash { from { background: var(--info-bg); } to { background: transparent; } }

/* ---- Modal secret ---- */
.modal { max-width: 560px; }
.secret-box {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md);
    padding: 12px 14px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; margin: 8px 0 14px;
}
.env-snippet { white-space: pre-wrap; }
.warn-note { background: var(--warning-bg); color: var(--warning); border-radius: var(--radius-md); padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.stat-card-icon { float: right; opacity: .35; }
.stat-card-icon .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.form-narrow { max-width: 460px; }
.mt-2 { margin-top: 16px; }
.err-text { color: var(--error); }

/* En-tête de panneau : le bouton garde sa taille, le texte passe à la ligne */
.panel-header { gap: 16px; }
.panel-header > div:first-child { flex: 1 1 auto; min-width: 0; }
.panel-header > .btn, .panel-header > .btn-sm { flex: 0 0 auto; width: auto; white-space: nowrap; }
@media (max-width: 640px) { .panel-header { flex-wrap: wrap; } }

/* ---- Vue d'ensemble : graphiques ---- */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
@media (max-width: 900px) { .charts-row { grid-template-columns: 1fr; } }
.chart-container { position: relative; width: 100%; height: 280px; }
.chart-container-tall { height: 220px; }
.panel { margin-bottom: 24px; }

/* ---- Largeurs de panneaux, divers ---- */
.w-720 { max-width: 720px; }
.w-860 { max-width: 860px; }
.otp-input { text-align: center; font-size: 22px; letter-spacing: 8px; font-family: ui-monospace, Consolas, monospace; }
.mt-1 { margin-top: 6px; }
.login-card .btn { width: 100%; }
.profile-option.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
a#goProfile { font-weight: 600; text-decoration: underline; color: inherit; }
.no-padding { padding: 0; }

/* ============================================================
   Barre supérieure (sobre, plate, de type console d'administration)
   ============================================================ */
.main-header.topbar {
    height: 60px; padding: 0 28px; background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color); box-shadow: none;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    position: sticky; top: 0; z-index: 50;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-titles { min-width: 0; line-height: 1.2; }
.topbar-crumb { font-size: 11px; letter-spacing: .02em; color: var(--text-tertiary); }
.topbar-crumb span { margin: 0 4px; opacity: .6; }
.topbar-title { font-size: 17px; font-weight: 650; letter-spacing: -.01em; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.live-status { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.live-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(0,135,90,.15); }
.live-status.off .live-status-dot { background: var(--text-tertiary); box-shadow: 0 0 0 3px rgba(139,148,167,.18); }

.topbar-btn {
    width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent; background: transparent; color: var(--text-secondary);
    border-radius: 8px; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.topbar-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.topbar-btn:focus-visible, .sidebar-toggle:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.topbar-btn .ico, .sidebar-toggle .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.topbar-sep { width: 1px; height: 24px; background: var(--border-color); }

.topbar-user { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.topbar-avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--bg-dark); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: 0 0 32px;
}
.topbar-user-text { line-height: 1.25; }
.topbar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.topbar-user-role { font-size: 11.5px; color: var(--text-tertiary); }

.sidebar-toggle { display: none; width: 36px; height: 36px; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--text-secondary); border-radius: 8px; cursor: pointer; }
.sidebar-toggle:hover { background: var(--bg-tertiary); }

@media (max-width: 900px) {
    .main-header.topbar { padding: 0 16px; }
    .sidebar-toggle { display: inline-flex; }
    .topbar-user-text, .live-status span:last-child { display: none; }
}
