/* Aktawifi — système design moderne (palette B teal+violet)
   Injecté in-place sur les pages legacy WiFi-CPA, ne touche pas au PHP métier.
   Utilise !important systématiquement pour vaincre les attributs HTML inline (bgcolor, width, etc). */

:root {
    --color-primary: #0D9488;
    --color-primary-hover: #0F766E;
    --color-accent: #8B5CF6;
    --color-accent-hover: #7C3AED;

    --color-bg: #F5F6F8;
    --color-surface: #FFFFFF;
    --color-surface-alt: #F3F4F6;
    --color-border: #D1D5DB;
    --color-border-strong: #9CA3AF;

    --color-text: #1F2937;
    --color-text-muted: #6B7280;
    --color-text-light: #9CA3AF;

    --color-success: #16A34A;
    --color-error: #DC2626;
    --color-warn: #F59E0B;

    --gradient-brand: linear-gradient(135deg, #0D9488 0%, #8B5CF6 100%);
    --gradient-brand-subtle: linear-gradient(135deg, rgba(13,148,136,0.05) 0%, rgba(139,92,246,0.05) 100%);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
}

/* ============ reset + base ============ */
html, body {
    background: var(--color-bg) !important;
    color: var(--color-text) !important;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ============ tuer Flash & spacers ============ */
object[classid*="D27CDB6E"],
object[type*="shockwave"],
embed[type*="shockwave"],
embed[src*=".swf"] {
    display: none !important;
}

td[bgcolor="CFDEF7"][width="1"],
td[bgcolor="CFDEF7"] {
    display: none !important;
}

img[src*="spacer.gif"],
img[src*="t22.gif"],
img[src*="t23.gif"],
img[src*="t25.gif"] {
    display: none !important;
}

/* la rangée décorative legacy en bas de la card (3 TDs avec background=t22/t23/t25.gif)
   et toute ligne spacer 1px bgcolor=CFDEF7 */
td[background*="t22.gif"],
td[background*="t23.gif"],
td[background*="t25.gif"],
tr:has(> td[background*="t22.gif"]),
tr:has(> td[bgcolor="CFDEF7"]) {
    display: none !important;
    height: 0 !important;
    background: none !important;
}

/* ============ neutralisation layout 770px legacy ============ */
body > center {
    display: block !important;
    text-align: left !important;
}

/* hide the entire first row of the outer table — Flash banner + spacers */
body > center > table > tbody > tr:first-child,
body > center > table > tbody > tr:last-child {
    display: none !important;
}

/* the outer page table → responsive wrapper */
body > center > table {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    border-collapse: collapse !important;
    border: 0 !important;
    background: transparent !important;
}

body > center > table > tbody > tr > td {
    padding: 0 24px 24px !important;
    background: transparent !important;
}

/* ============ inner content card ============ */
/* l'inner table (width=770) au sein du contenu devient la card principale */
body > center > table > tbody > tr > td > table {
    background: var(--color-surface) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm) !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* la TD blanche racine de la card */
body > center > table > tbody > tr > td > table > tbody > tr > td[bgcolor="#FFFFFF"] {
    background: var(--color-surface) !important;
    padding: 24px !important;
}

/* ============ header (gradient bandeau) ============ */
.ak-header {
    background: linear-gradient(90deg, #0D9488 0%, #FB7185 100%);
    border-bottom: 0;
    margin: 0;
    padding: 0;
}
.ak-header__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.ak-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.ak-brand {
    font-weight: 700;
    font-size: 20px;
    color: #FFFFFF;
    letter-spacing: -0.02em;
}
.ak-brand-suffix {
    color: rgba(255,255,255,0.75);
    font-weight: 400;
    font-size: 15px;
    margin-left: 6px;
}
.ak-spacer { flex: 1; }
.ak-user {
    color: rgba(255,255,255,0.9);
    font-size: 15px;
}
.ak-user strong {
    color: #FFFFFF;
    font-weight: 600;
}
.ak-user a {
    color: #FFFFFF;
    text-decoration: none;
    margin-left: 14px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.4);
    padding-bottom: 1px;
}
.ak-user a:hover { border-bottom-color: #FFFFFF; }

/* switcher de langue dans le header */
.ak-lang-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    min-width: 32px;
    padding: 0 8px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 4px;
    color: #FFFFFF !important;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    letter-spacing: 0.04em;
    transition: background-color 0.15s, border-color 0.15s;
}
.ak-lang-switch:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.7);
    color: #FFFFFF !important;
    text-decoration: none !important;
}

/* la bande 3px gradient devient redondante avec le header en gradient — masquée */
.ak-strip { display: none; }

/* la bande gradient 3px sous le header */
.ak-strip {
    height: 3px;
    background: var(--gradient-brand);
    margin: 0 0 24px;
}

/* ============ typo ============ */
h1, h2, h3, h4 {
    color: var(--color-text) !important;
    letter-spacing: -0.02em !important;
    margin: 0 0 12px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    text-align: left !important;
}
h1 { font-size: 22px !important; font-weight: 700 !important; }
h2 { font-size: 18px !important; font-weight: 600 !important; margin-top: 28px !important; }
h3 {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--color-text-muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    margin: 16px 0 8px !important;
}

p { margin: 8px 0 !important; }

/* ============ liens ============ */
a {
    color: var(--color-primary) !important;
    text-decoration: none !important;
}
a:hover {
    color: var(--color-primary-hover) !important;
    text-decoration: underline !important;
}

/* ============ inputs/boutons ============ */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
select, textarea {
    height: 36px;
    box-sizing: border-box !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-sm) !important;
    padding: 0 12px !important;
    background: var(--color-surface) !important;
    font-family: inherit !important;
    font-size: 14px !important;
    color: var(--color-text) !important;
    outline: none !important;
    transition: border-color 0.15s, box-shadow 0.15s !important;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
select:focus, textarea:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12) !important;
}

input[type="submit"],
input[type="button"],
input[type="BUTTON"],
button {
    height: 36px;
    padding: 0 16px !important;
    background: var(--color-primary) !important;
    color: white !important;
    border: 0 !important;
    border-radius: var(--radius-sm) !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    letter-spacing: 0.01em !important;
    transition: background-color 0.15s !important;
    box-shadow: var(--shadow-sm) !important;
}
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="BUTTON"]:hover,
button:hover {
    background: var(--color-primary-hover) !important;
}

/* bouton "Manage" (le plus utilisé) — ghost discret pour pas saturer la liste */
input[name="BUTTON2"][value="Manage"],
input[name="BUTTON2"][value="Gérer"] {
    background: transparent !important;
    color: var(--color-primary) !important;
    border: 1px solid var(--color-border) !important;
    box-shadow: none !important;
}
input[name="BUTTON2"][value="Manage"]:hover,
input[name="BUTTON2"][value="Gérer"]:hover {
    background: var(--color-primary) !important;
    color: white !important;
    border-color: var(--color-primary) !important;
}

/* checkbox / radio — défaut ok */
input[type="checkbox"], input[type="radio"] {
    accent-color: var(--color-primary);
}

/* form sans bordure ajoutée */
form { display: inline-block; margin: 0; padding: 0; }

/* ============ tables data legacy ============ */

/* en-tête de table data avec bgcolor=#006699 → bandeau gris clair */
td[bgcolor="#006699"] {
    background: var(--color-surface-alt) !important;
    color: var(--color-text-muted) !important;
    border-bottom: 1px solid var(--color-border) !important;
    border-top: 1px solid var(--color-border) !important;
    padding: 10px 12px !important;
    text-align: left !important;
}
td[bgcolor="#006699"] .style12 {
    color: var(--color-text-muted) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

/* lignes data zebra */
td.vtable[bgcolor="#FFFFFF"],
td.vtable {
    background: var(--color-surface) !important;
    padding: 14px 12px !important;
    border-bottom: 1px solid var(--color-border) !important;
    vertical-align: middle !important;
}
td.vtable[bgcolor="#EEEEEE"] {
    background: var(--color-surface-alt) !important;
    padding: 14px 12px !important;
    border-bottom: 1px solid var(--color-border) !important;
}

/* style13 = nom de hotspot dans la liste */
.style13 {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--color-text) !important;
}

.smalltext, .style7 {
    font-size: 12px !important;
    color: var(--color-text-muted) !important;
    font-weight: 400 !important;
}

.vncellreq {
    color: var(--color-text-muted) !important;
    padding: 6px 0 !important;
    background: transparent !important;
    border: 0 !important;
}

/* le bandeau "Stats | Visitors" du haut (vncellreq avec liens) */
.vncellreq .style12 {
    color: var(--color-text) !important;
}
.vncellreq .style12 a {
    color: var(--color-text) !important;
    font-weight: 500 !important;
    padding: 6px 12px !important;
    border-radius: var(--radius-sm) !important;
    background: var(--color-surface-alt) !important;
    margin-right: 6px !important;
    display: inline-block;
    font-size: 13px !important;
    border: 1px solid var(--color-border) !important;
    transition: all 0.15s;
}
.vncellreq .style12 a:hover {
    background: var(--color-primary) !important;
    color: white !important;
    border-color: var(--color-primary) !important;
    text-decoration: none !important;
}

/* ============ icônes statut ============ */
img[src*="check.png"],
img[src*="forbidden.png"],
img[src*="alert.gif"] {
    width: 18px !important;
    height: 18px !important;
    vertical-align: middle !important;
}

/* ============ <font color> legacy → variables ============ */
font[color="orange"] u { color: var(--color-warn) !important; text-decoration: none !important; font-weight: 500; }
font[color="blue"] u { color: var(--color-primary) !important; text-decoration: none !important; font-weight: 500; }
font[color="green"] u { color: var(--color-success) !important; text-decoration: none !important; font-weight: 500; }
font[color="red"] u { color: var(--color-error) !important; text-decoration: none !important; font-weight: 500; }
font[color="violet"] u, font[color="purple"] u { color: var(--color-accent) !important; text-decoration: none !important; font-weight: 500; }
font[color="grey"] u { color: var(--color-text-muted) !important; text-decoration: none !important; font-weight: 500; }
font[color="red"] b { color: var(--color-error) !important; }

/* ============ welcome bar (top right legacy) — le rendre plus discret puisque le header le gère déjà ============ */
.style2 { color: var(--color-text-muted) !important; }

/* ============ responsive ============ */
@media (max-width: 768px) {
    .ak-header__inner { padding: 12px 16px; gap: 10px; }
    .ak-brand { font-size: 15px; }
    .ak-brand-suffix { display: none; }
    .ak-user { font-size: 12px; }
    .ak-user a { margin-left: 8px; }

    body > center > table > tbody > tr > td { padding: 0 12px 16px !important; }

    body > center > table > tbody > tr > td > table > tbody > tr > td[bgcolor="#FFFFFF"] {
        padding: 16px !important;
    }

    /* tables data : on autorise scroll horizontal pour pas casser la grille */
    .vtable, td.vtable { padding: 10px 8px !important; font-size: 13px !important; }
    .style13 { font-size: 13px !important; }

    h1 { font-size: 18px !important; }
    h2 { font-size: 16px !important; }
}

/* ============================================================
   COMPOSANTS MODERNES — utilisés par les pages refondues
   ============================================================ */

.ak-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 64px;
    text-align: left;
}

/* page header (titre + actions) */
.ak-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 0 20px;
    flex-wrap: wrap;
}
.ak-page-header__title h1 {
    font-size: 24px !important;
    font-weight: 700 !important;
    margin: 0 0 4px !important;
}
.ak-page-header__sub {
    color: var(--color-text-muted);
    font-size: 13px;
    margin: 0;
}
.ak-page-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* boutons modernes (overrides l'input[type=button] global au besoin) */
.ak-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none !important;
    cursor: pointer;
    border: 1px solid transparent;
    background: var(--color-primary);
    color: white !important;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.ak-btn:hover { background: var(--color-primary-hover); color: white !important; text-decoration: none !important; }

.ak-btn--primary { background: var(--color-primary); color: white !important; }
.ak-btn--primary:hover { background: var(--color-primary-hover); }

.ak-btn--ghost {
    background: transparent;
    color: var(--color-text) !important;
    border-color: var(--color-border);
}
.ak-btn--ghost:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-border-strong);
    color: var(--color-text) !important;
}

.ak-btn--accent { background: var(--color-accent); }
.ak-btn--accent:hover { background: var(--color-accent-hover); }

.ak-btn--sm { height: 30px; padding: 0 10px; font-size: 12px; }

/* stats grid (4 cards) */
.ak-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.ak-stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    margin: 0;
    position: relative;
}
.ak-stat-card--accent {
    border-left: 3px solid var(--color-accent);
}
.ak-stat-label {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: var(--color-text-muted) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 8px !important;
}
.ak-stat-value {
    font-size: 28px !important;
    font-weight: 700 !important;
    color: var(--color-text) !important;
    margin: 0 !important;
    line-height: 1.1 !important;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.ak-stat-sub {
    font-size: 12px !important;
    color: var(--color-text-light) !important;
    margin: 6px 0 0 !important;
}

/* alert banner */
.ak-alert {
    background: var(--gradient-brand-subtle);
    border-left: 3px solid var(--color-accent);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--color-text);
    margin-bottom: 24px;
}
.ak-alert--error {
    background: rgba(220,38,38,0.06);
    border-left-color: var(--color-error);
}
.ak-alert--success {
    background: rgba(22,163,74,0.06);
    border-left-color: var(--color-success);
}
.ak-alert--warn {
    background: rgba(245,158,11,0.08);
    border-left-color: var(--color-warn);
}
.ak-alert strong { color: var(--color-text); }
.ak-alert code {
    background: rgba(0,0,0,0.05);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* toolbar (search forms) */
.ak-toolbar {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.ak-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
}
.ak-search input[type="text"] { min-width: 220px; }

.ak-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    font-size: 12px;
    color: var(--color-text-muted) !important;
    text-decoration: none !important;
}
.ak-chip:hover { background: var(--color-surface); color: var(--color-text) !important; text-decoration: none !important; }
.ak-chip__x {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-text-muted);
    color: white !important;
    font-size: 11px;
    line-height: 14px;
    text-align: center;
    font-weight: 600;
}

/* card container */
.ak-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.ak-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    gap: 12px;
}
.ak-card-header h2 {
    font-size: 15px !important;
    font-weight: 600 !important;
    margin: 0 !important;
    color: var(--color-text) !important;
    text-transform: none !important;
    letter-spacing: -0.01em !important;
}

/* empty state */
.ak-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--color-text-muted);
}
.ak-empty p { margin: 0 0 12px; }

/* tables modernes */
.ak-table-wrap {
    overflow-x: auto;
}
.ak-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ak-table thead th {
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}
.ak-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    color: var(--color-text);
}
.ak-table tbody tr:last-child td { border-bottom: 0; }
.ak-table tbody tr:hover td { background: var(--color-surface-alt); }

.ak-table__site { min-width: 220px; }
.ak-table__actions { width: 1px; white-space: nowrap; text-align: right; }
.ak-num { text-align: right; font-variant-numeric: tabular-nums; }
.ak-table thead th.ak-num { text-align: right; }

/* site cell : nom + sous-texte */
.ak-site { display: flex; flex-direction: column; gap: 2px; }
.ak-site strong { font-weight: 600; color: var(--color-text); font-size: 14px; }
.ak-site__sub { font-size: 12px; color: var(--color-text-muted); }

/* mono (NASID, etc) */
.ak-mono {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12px;
    color: var(--color-text-muted);
    background: var(--color-surface-alt);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

/* badges (status) */
.ak-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: var(--color-surface-alt);
    color: var(--color-text);
    white-space: nowrap;
}
.ak-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.ak-badge--success { color: var(--color-success); background: rgba(22,163,74,0.10); }
.ak-badge--error { color: var(--color-error); background: rgba(220,38,38,0.08); }
.ak-badge--warn { color: var(--color-warn); background: rgba(245,158,11,0.10); }
.ak-badge--accent { color: var(--color-accent); background: rgba(139,92,246,0.10); }

/* tags (type portail) */
.ak-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 4px;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}
.ak-tag--success { color: var(--color-success); background: rgba(22,163,74,0.08); border-color: rgba(22,163,74,0.18); }
.ak-tag--error { color: var(--color-error); background: rgba(220,38,38,0.06); border-color: rgba(220,38,38,0.18); }
.ak-tag--warn { color: var(--color-warn); background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.20); }
.ak-tag--info { color: var(--color-primary); background: rgba(13,148,136,0.06); border-color: rgba(13,148,136,0.18); }
.ak-tag--accent { color: var(--color-accent); background: rgba(139,92,246,0.06); border-color: rgba(139,92,246,0.18); }

/* muted text */
.ak-muted { color: var(--color-text-muted); }
.ak-muted--sm { font-size: 12px; }
.ak-muted--error { color: var(--color-error); font-size: 12px; }

/* page footer */
.ak-page-footer {
    margin-top: 32px;
    padding: 16px 0;
    color: var(--color-text-light);
    font-size: 12px;
    text-align: center;
}

/* responsive — stats stack on mobile, table scrolls */
@media (max-width: 980px) {
    .ak-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .ak-page { padding: 0 12px 32px; }
    .ak-page-header { padding: 16px 0 12px; }
    .ak-page-header__title h1 { font-size: 20px !important; }
    .ak-page-header__actions { width: 100%; }
    .ak-page-header__actions .ak-btn { flex: 1; }
    .ak-stats { grid-template-columns: 1fr; gap: 10px; }
    .ak-stat-value { font-size: 24px !important; }
    .ak-card-header { padding: 12px 14px; }
    .ak-table thead th, .ak-table tbody td { padding: 10px 12px; }
    .ak-search input[type="text"] { min-width: 180px; flex: 1; }
}

/* ============================================================
   COMPOSANTS — page hotspot detail (full rewrite)
   ============================================================ */

/* back link */
.ak-back {
    display: inline-block;
    color: var(--color-text-muted) !important;
    font-size: 13px;
    margin-bottom: 4px;
    text-decoration: none !important;
}
.ak-back:hover { color: var(--color-primary) !important; text-decoration: none !important; }

/* tabs (sub-page nav contextuelle au hotspot) */
.ak-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
}
.ak-tabs::-webkit-scrollbar { height: 4px; }
.ak-tabs::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

.ak-tab {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--color-text-muted) !important;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none !important;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.ak-tab:hover {
    color: var(--color-text) !important;
    text-decoration: none !important;
}
.ak-tab.is-active {
    color: var(--color-primary) !important;
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

/* stats grid 3 col variant */
.ak-stats--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) {
    .ak-stats--3 { grid-template-columns: 1fr; }
}

/* stat unit (KB, %, ...) */
.ak-stat-unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-left: 2px;
}

/* badge variant small */
.ak-badge--sm {
    height: 20px;
    padding: 0 8px;
    font-size: 11px;
}

/* toggle list (services on/off) — grille 3 col compacte */
.ak-toggles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}
.ak-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    min-height: 44px;
}
.ak-toggle-row:nth-child(3n) { border-right: 0; }
/* dernière rangée : retirer la bordure du bas — calcul selon nb d'items */
.ak-toggle-row:nth-last-child(-n+3):nth-child(3n+1),
.ak-toggle-row:nth-last-child(-n+3):nth-child(3n+1) ~ .ak-toggle-row {
    border-bottom: 0;
}

.ak-toggle-row > div:first-child { min-width: 0; flex: 1; }
.ak-toggle-row strong {
    display: block;
    font-weight: 600;
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.2;
}
.ak-toggle-desc {
    margin: 1px 0 0 !important;
    font-size: 11px;
    color: var(--color-text-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ak-toggle-row__action {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.ak-toggle-row__action form { margin: 0; }

/* btn danger */
.ak-btn--danger {
    color: var(--color-error) !important;
    border-color: rgba(220,38,38,0.25);
}
.ak-btn--danger:hover {
    background: var(--color-error) !important;
    color: white !important;
    border-color: var(--color-error) !important;
}

/* form fields */
/* Override la règle globale form { display: inline-block } pour les forms imbriqués
   dans le design moderne (ak-card, ak-form, ak-form-shell). Sans ça les <form>
   parents rétrécissent à la largeur de leur contenu et un <textarea width:100%>
   se retrouve compressé à gauche. */
.ak-form-shell,
.ak-card > form,
.ak-card > .ak-form > form,
.ak-form > form,
.ak-form--padded > form {
    display: block !important;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* deux cards côte à côte (Mode + Identité) */
.ak-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}
.ak-form-row > .ak-card {
    margin-bottom: 0;
}
@media (max-width: 760px) {
    .ak-form-row { grid-template-columns: 1fr; gap: 16px; }
}

.ak-form { display: block; }
.ak-form--padded { padding: 20px; }
.ak-form--grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 20px;
}
.ak-form--grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 20px;
}
.ak-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.ak-field--wide { grid-column: 1 / -1; }
.ak-field--span-2 { grid-column: span 2; }
.ak-field--span-3 { grid-column: span 3; }
.ak-field--span-4 { grid-column: span 4; }

.ak-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    text-transform: none;
    letter-spacing: 0;
}
.ak-field input[type="text"],
.ak-field input[type="email"],
.ak-field input[type="password"],
.ak-field select,
.ak-field textarea {
    width: 100%;
}
.ak-field-hint {
    margin: 0 !important;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* textarea */
.ak-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px !important;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-sm) !important;
    background: var(--color-surface) !important;
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 1.5;
    color: var(--color-text) !important;
    resize: vertical;
    box-sizing: border-box;
    height: auto !important;
}
.ak-textarea:focus {
    outline: none !important;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12) !important;
}

/* form-actions block */
.ak-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 12px;
}
.ak-form-actions--padded {
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    margin-top: 0;
}

/* category block (packages page) */
.ak-cat-block {
    border-bottom: 1px solid var(--color-border);
}
.ak-cat-block:last-child { border-bottom: 0; }
.ak-cat-header {
    padding: 12px 20px;
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
}
.ak-cat-title {
    margin: 0 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text) !important;
}
.ak-cat-empty {
    padding: 14px 20px;
    color: var(--color-text-muted);
    font-size: 13px;
    font-style: italic;
}

/* pagination */
.ak-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    gap: 12px;
}
.ak-pagination__btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* iframe (filemanager etc.) */
.ak-iframe {
    width: 100%;
    height: 480px;
    border: 0;
    display: block;
    background: var(--color-surface-alt);
}

/* responsive form grid */
@media (max-width: 900px) {
    .ak-form--grid-4 { grid-template-columns: repeat(2, 1fr); }
    .ak-form--grid-4 .ak-field--span-2 { grid-column: span 2; }
    .ak-form--grid-4 .ak-field--span-3,
    .ak-form--grid-4 .ak-field--span-4 { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    .ak-form--grid { grid-template-columns: 1fr; }
    .ak-form--grid-4 { grid-template-columns: 1fr; }
    .ak-form--grid-4 .ak-field--span-2,
    .ak-form--grid-4 .ak-field--span-3,
    .ak-form--grid-4 .ak-field--span-4 { grid-column: 1 / -1; }
    .ak-toggles { grid-template-columns: 1fr; }
    .ak-toggle-row { border-right: 0; padding: 10px 14px; }
    .ak-toggle-row { border-bottom: 1px solid var(--color-border); }
    .ak-toggle-row:last-child { border-bottom: 0; }
    .ak-iframe { height: 360px; }
}
@media (max-width: 980px) and (min-width: 701px) {
    .ak-toggles { grid-template-columns: repeat(2, 1fr); }
    .ak-toggle-row { border-right: 1px solid var(--color-border); }
    .ak-toggle-row:nth-child(3n) { border-right: 1px solid var(--color-border); }
    .ak-toggle-row:nth-child(2n) { border-right: 0; }
}

/* ============================================================
   Neutralisation du qmmc legacy (menu_main.php) — sur les pages
   en injection-only il s'affiche encore en bas des pages avec
   un style horrible. On le masque carrément.
   ============================================================ */
#qm0, .qmmc, .qmclear, .qmsh, .qmpcss, .qmlt, .qmrt, .qmlb, .qmrb { display: none !important; }

/* required-field marker */
.ak-req {
    color: var(--color-error);
    font-weight: 600;
    margin-left: 2px;
}

/* table cell w/ inline actions */
.ak-td-actions {
    text-align: right;
    white-space: nowrap;
}
.ak-td-actions .ak-btn { margin-left: 4px; }

/* Permission groups (sub-account create/edit) */
.ak-perm-group {
    border-top: 1px solid var(--color-border);
    padding: 14px 0 6px;
}
.ak-perm-group:first-child { border-top: 0; padding-top: 0; }
.ak-perm-group__title {
    margin: 0 0 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted) !important;
}
.ak-perm-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 16px;
}
.ak-perm-grid .ak-toggle-row {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 10px 12px;
    background: var(--color-surface-alt);
}
@media (max-width: 980px) {
    .ak-perm-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .ak-perm-grid { grid-template-columns: 1fr; }
}

/* Code block (CSV format docs) */
.ak-code {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 10px 14px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--color-text);
    overflow-x: auto;
    white-space: pre;
    margin: 8px 0 12px;
}

/* Help text under a card section */
.ak-help {
    color: var(--color-text-muted);
    font-size: 13px;
    margin-top: 6px;
}

/* Compact table variant (CSV preview) */
.ak-table--compact th,
.ak-table--compact td {
    padding: 6px 8px;
    font-size: 12px;
    white-space: nowrap;
}

/* Inline checkbox label inside a field */
.ak-checkbox {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
}
.ak-checkbox input[type="checkbox"] { margin-top: 2px; }

/* Inline time selectors (HH : MM) */
.ak-inline-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ak-inline-time select {
    width: auto;
    min-width: 64px;
}

/* Inline action form (single row: select + button) */
.ak-inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.ak-inline-form select,
.ak-inline-form input[type="text"] {
    flex: 1;
    min-width: 200px;
}

/* User-detail RRD graphs grid */
.ak-graphs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px 20px;
}
.ak-graph {
    margin: 0;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}
.ak-graph figcaption {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}
.ak-graph img {
    max-width: 100%;
    height: auto;
}
@media (max-width: 760px) {
    .ak-graphs { grid-template-columns: 1fr; }
}

/* Sous-navigation (utilisée par les pages mesh : edit / view / addnode / etc.) */
.ak-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 20px;
    margin-bottom: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}
.ak-subnav__btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none !important;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ak-subnav__btn:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
    border-color: var(--color-border);
}
.ak-subnav__btn.is-active,
.ak-subnav__btn.is-active:hover,
.ak-subnav__btn.is-active:visited {
    background: var(--color-primary) !important;
    color: white !important;
    border-color: var(--color-primary) !important;
    cursor: default;
    text-decoration: none !important;
}
@media (max-width: 600px) {
    .ak-subnav { gap: 4px; padding: 10px 12px; }
    .ak-subnav__btn { padding: 5px 9px; font-size: 12px; }
}

/* Liste clé / valeur (fiches détaillées : node info, etc.) */
.ak-kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 10px 18px;
    margin: 0;
}
.ak-kv dt {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
    padding-top: 2px;
}
.ak-kv dd {
    font-size: 14px;
    color: var(--color-text);
    margin: 0;
    word-break: break-word;
}
.ak-kv dd code.ak-mono { font-size: 12px; }

