/* ==========================================================================
   DESIGN SYSTEM — abrt dashboard
   Modern, clean, dark + light with auto theme toggle
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---------- Design tokens ---------- */
:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;

    /* Spacing scale (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Category accents (mode-agnostic) */
    --accent-portfolio: #3b82f6;
    --accent-projet:    #10b981;
    --accent-admin:     #ef4444;
}

/* Dark theme (default) */
:root,
:root[data-theme="dark"] {
    color-scheme: dark;

    --bg:            #08090b;
    --bg-grad:       radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,0.10), transparent 70%);
    --surface:       #0f1115;
    --surface-2:     #15181d;
    --surface-3:     #1c2027;
    --surface-hover: #1f242c;
    --border:        #1f232b;
    --border-strong: #2a2f38;
    --border-focus:  #6366f1;

    --text:          #f4f4f5;
    --text-muted:    #a1a1aa;
    --text-subtle:   #71717a;
    --text-faint:    #52525b;

    --accent:        #6366f1;
    --accent-hover:  #818cf8;
    --accent-fg:     #ffffff;
    --accent-bg:     rgba(99,102,241,0.12);
    --accent-border: rgba(99,102,241,0.35);

    --success:       #10b981;
    --warning:       #f59e0b;
    --danger:        #ef4444;

    --shadow-sm:  0 1px 2px rgba(0,0,0,0.4);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.45);
    --shadow-lg:  0 12px 32px rgba(0,0,0,0.55);
    --shadow-glow: 0 0 0 1px rgba(99,102,241,0.3), 0 8px 32px rgba(99,102,241,0.15);

    /* Conteneur du logo brand : fond clair en dark (le SVG a des éléments très sombres) */
    --brand-icon-bg:     transparent;
    --brand-icon-border: transparent;
    --brand-icon-shadow: none;
}

/* Light theme */
:root[data-theme="light"] {
    color-scheme: light;

    --bg:            #fafafa;
    --bg-grad:       radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,0.08), transparent 70%);
    --surface:       #ffffff;
    --surface-2:     #f4f4f5;
    --surface-3:     #e4e4e7;
    --surface-hover: #f9fafb;
    --border:        #e4e4e7;
    --border-strong: #d4d4d8;
    --border-focus:  #6366f1;

    --text:          #09090b;
    --text-muted:    #52525b;
    --text-subtle:   #71717a;
    --text-faint:    #a1a1aa;

    --accent:        #4f46e5;
    --accent-hover:  #4338ca;
    --accent-fg:     #ffffff;
    --accent-bg:     rgba(79,70,229,0.08);
    --accent-border: rgba(79,70,229,0.25);

    --success:       #059669;
    --warning:       #d97706;
    --danger:        #dc2626;

    --shadow-sm:  0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg:  0 12px 32px rgba(0,0,0,0.10);
    --shadow-glow: 0 0 0 1px rgba(79,70,229,0.2), 0 8px 32px rgba(79,70,229,0.10);

    /* Logo en mode clair : fond très subtil pour rester discret */
    --brand-icon-bg:     transparent;
    --brand-icon-border: transparent;
    --brand-icon-shadow: none;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    background-image: var(--bg-grad);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--t-base), color var(--t-base);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

::selection { background: var(--accent-bg); color: var(--text); }

/* ---------- Header ---------- */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-8);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--border);
}

.server-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: var(--brand-icon-bg);
    border: 1px solid var(--brand-icon-border);
    box-shadow: var(--brand-icon-shadow);
    overflow: hidden;
    flex-shrink: 0;
}
.server-icon img { width: 44px; height: 44px; }

.header-title { display: flex; flex-direction: column; gap: 2px; }
.header-title h1 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}
.header-title p {
    font-size: 0.78rem;
    color: var(--text-subtle);
    font-weight: 400;
}

/* Header actions cluster (theme toggle + session) */
.header-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.session-info {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.85rem;
}
.session-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    padding: 7px 10px;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    border: 1px solid var(--border);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.session-logout,
.session-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-muted);
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    transition: all var(--t-fast);
    font-weight: 500;
}
.session-logout { padding: 7px 10px; }
.session-logout:hover { color: var(--danger); border-color: var(--danger); }
.session-login:hover  { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--t-fast);
    flex-shrink: 0;
    padding: 0;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun  { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: block; }

/* ---------- Main ---------- */
main {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--space-10) var(--space-8) 120px;
}

/* ---------- Dashboard tabs ---------- */
.dashboard-tabs {
    position: relative;
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-8);
    padding-bottom: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.dashboard-tabs::-webkit-scrollbar { display: none; }

.dashboard-tab {
    position: relative;
    padding: 12px 18px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    transition: color var(--t-fast);
    white-space: nowrap;
    z-index: 1;
}
.dashboard-tab:hover { color: var(--text); }
.dashboard-tab.active { color: var(--accent); font-weight: 600; }
.dashboard-tab[data-view="admin"].active { color: var(--danger); }
.dashboard-tab[data-view="projets"].active { color: var(--success); }

.tab-underline {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    transition: transform var(--t-slow), width var(--t-slow), background var(--t-fast);
}
.tab-underline[data-view="admin"]   { background: var(--danger);  }
.tab-underline[data-view="projets"] { background: var(--success); }

.dashboard-empty {
    text-align: center;
    color: var(--text-subtle);
    padding: var(--space-16) var(--space-4);
    font-size: 0.95rem;
}

/* ---------- Section titles ---------- */
.section-title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-subtle);
    margin: var(--space-10) 0 var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.section-title:first-of-type { margin-top: 0; }
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ---------- Grid ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

/* ---------- Cards ---------- */
.card {
    --accent: var(--accent-portfolio);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    cursor: pointer;
    overflow: hidden;
    transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--accent), transparent 60%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--t-base);
    pointer-events: none;
}
.card:hover {
    transform: translateY(-2px);
    border-color: transparent;
    box-shadow: var(--shadow-md);
    background: var(--surface-hover);
}
.card:hover::before { opacity: 1; }

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
}
.card-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--t-fast);
}
.card:hover .card-icon {
    background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.card-title {
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-badge-slot {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 22px;
}
.card-description {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 2px;
}

/* Page cards (children) */
.card.page-card {
    background: var(--surface-2);
    padding: var(--space-3) var(--space-4);
}
.card.page-card .card-icon { width: 32px; height: 32px; font-size: 1rem; }
.card.page-card .card-title { font-size: 0.88rem; }
.card.page-card .card-description { font-size: 0.76rem; }
.card.page-card[data-depth="1"] { margin-left: var(--space-6); }
.card.page-card[data-depth="2"] { margin-left: var(--space-12); }
.card.page-card[data-depth="3"] { margin-left: 72px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}
.badge-portfolio {
    color: var(--accent-portfolio);
    background: color-mix(in srgb, var(--accent-portfolio) 12%, transparent);
    border-color: color-mix(in srgb, var(--accent-portfolio) 30%, transparent);
}
.badge-projet {
    color: var(--accent-projet);
    background: color-mix(in srgb, var(--accent-projet) 12%, transparent);
    border-color: color-mix(in srgb, var(--accent-projet) 30%, transparent);
}
.badge-admin {
    color: var(--accent-admin);
    background: color-mix(in srgb, var(--accent-admin) 12%, transparent);
    border-color: color-mix(in srgb, var(--accent-admin) 30%, transparent);
}

/* ---------- Hierarchy list (Portfolio view) ---------- */
.hl-table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-top: var(--space-4);
}
.hl-block { border-bottom: 1px solid var(--border); }
.hl-block:last-child { border-bottom: none; }

.hl-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 12px var(--space-4);
    transition: background var(--t-fast);
    color: var(--text);
}
.hl-row:hover { background: var(--surface-hover); }

.hl-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 500;
    flex-shrink: 0;
    transition: color var(--t-fast);
}
.hl-link:hover { color: var(--accent); }

.hl-arrow {
    color: var(--text-faint);
    font-family: var(--font-mono);
    flex-shrink: 0;
}
.hl-icon { font-size: 1.05rem; flex-shrink: 0; }
.hl-name { white-space: nowrap; font-weight: 500; }
.hl-desc {
    color: var(--text-subtle);
    font-size: 0.8rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hl-expand {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    transition: all var(--t-fast);
    flex-shrink: 0;
}
.hl-expand:hover,
.hl-block.open .hl-expand {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-bg);
}

.hl-children { display: none; background: var(--surface-2); }
.hl-block.open .hl-children { display: block; }
.hl-row.hl-child {
    padding-left: var(--space-8);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

/* Site row (header of hierarchy) */
.hl-row.hl-site {
    background: linear-gradient(135deg, var(--surface-2), var(--surface));
    border-bottom: 1px solid var(--border-strong);
    padding: var(--space-4);
    position: relative;
}
.hl-row.hl-site::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
}
.hl-row.hl-site .hl-icon-site {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
    color: var(--accent);
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    flex-shrink: 0;
}
.hl-row.hl-site .hl-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.hl-version {
    margin-left: auto;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: var(--accent-bg);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    flex-shrink: 0;
}

/* ---------- Footer ---------- */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: var(--space-4) var(--space-6);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    color: var(--text-subtle);
    font-size: 0.78rem;
    z-index: 40;
}
footer span { color: var(--text-muted); }
footer span:first-child { color: var(--accent); font-weight: 600; }

/* ---------- Forms (used by login etc.) ---------- */
.input {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    outline: none;
}
.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.input::placeholder { color: var(--text-faint); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t-fast);
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, black); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    header {
        padding: var(--space-3) var(--space-4);
        gap: var(--space-2);
        align-items: center;
    }
    .header-title {
        min-width: 0;
        flex: 1 1 auto;
    }
    .header-title h1 {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .header-title p { font-size: 0.7rem; display: none; }
    .header-actions { gap: 6px; }
    .session-user {
        max-width: 110px;
        padding: 6px 10px;
        font-size: 0.78rem;
    }
    .session-logout, .session-login { padding: 6px 10px; }
    .session-login-text { display: none; }
    .theme-toggle { width: 36px; height: 36px; }
    main { padding: var(--space-6) var(--space-4) 100px; }
    .grid { grid-template-columns: 1fr; gap: var(--space-3); }
    .dashboard-tab { padding: 10px 14px; font-size: 0.82rem; }
    .card.page-card[data-depth="1"] { margin-left: var(--space-3); }
    .card.page-card[data-depth="2"] { margin-left: var(--space-6); }
    .card.page-card[data-depth="3"] { margin-left: 36px; }
    .hl-row { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
    .hl-desc { flex-basis: 100%; padding-left: 26px; font-size: 0.74rem; }
}

@media (max-width: 768px) {
    .server-icon { width: 46px; height: 46px; }
    .server-icon img { width: 32px; height: 32px; }
    .adm-brand img { width: 46px; height: 46px; padding: 6px; }
}

@media (max-width: 400px) {
    .server-icon { width: 42px; height: 42px; }
    .server-icon img { width: 28px; height: 28px; }
    .adm-brand img { width: 42px; height: 42px; padding: 5px; }
    .header-title h1 { font-size: 0.88rem; }
    .session-user { display: none; }
    .session-info { gap: 4px; }
}

@media (min-width: 1025px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* Hide elements helper */
.hidden { display: none !important; }

/* Access denied banner */
.access-denied-banner {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: var(--space-6);
    text-align: center;
    font-size: 0.88rem;
    font-weight: 500;
}
.access-denied-banner a {
    color: var(--danger);
    text-decoration: underline;
    margin-left: var(--space-2);
    font-weight: 600;
}

/* ==========================================================================
   ADMIN — composants partagés (header / footer / user pill / stats)
   ========================================================================== */

.adm-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--border);
}
.adm-header-inner {
    padding: var(--space-4) var(--space-8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}
.adm-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--text);
    min-width: 0;
}
.adm-brand img {
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: var(--radius-lg);
    background: var(--brand-icon-bg);
    border: 1px solid var(--brand-icon-border);
    box-shadow: var(--brand-icon-shadow);
    flex-shrink: 0;
}
.adm-brand h1 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    line-height: 1.2;
}
.adm-brand p {
    font-size: 0.78rem;
    color: var(--text-subtle);
    margin-top: 2px;
}

.adm-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--text-muted);
}
.user-name {
    white-space: nowrap;
    font-weight: 500;
    color: var(--text);
}
.user-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    border-radius: var(--radius-full);
    transition: all var(--t-fast);
}
.user-logout:hover {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.adm-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6) 90px;
}

.adm-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    padding: var(--space-3) var(--space-4);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 40;
}
.adm-footer .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    transition: all var(--t-fast);
}
.adm-footer .back-link:hover {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    text-align: center;
    transition: border-color var(--t-fast);
}
.stat-card:hover { border-color: var(--border-strong); }
.stat-card .num {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.stat-card .num.ok   { color: var(--success); }
.stat-card .num.warn { color: var(--warning); }
.stat-card .num.err  { color: var(--danger); }
.stat-card .lbl {
    font-size: 0.78rem;
    color: var(--text-subtle);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

/* Filters */
.filter-bar {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}
.filter-btn {
    padding: 7px 14px;
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all var(--t-fast);
    font-family: inherit;
}
.filter-btn:hover { color: var(--text); border-color: var(--border-strong); }
.filter-btn.active {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
}

/* Empty state */
.empty-state {
    text-align: center;
    color: var(--text-subtle);
    padding: var(--space-12) var(--space-4);
    font-size: 0.95rem;
}

/* Messages */
.msg {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: var(--space-4);
}
.msg.success {
    background: color-mix(in srgb, var(--success) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
    color: var(--success);
}
.msg.error {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    color: var(--danger);
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .adm-header-inner { padding: var(--space-3) var(--space-4); gap: var(--space-2); }
    .adm-main { padding: var(--space-6) var(--space-4) 80px; }
    .stat-card { padding: var(--space-4); }
    .stat-card .num { font-size: 1.3rem; }
    .adm-brand h1 { font-size: 0.95rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); gap: var(--space-2); }
    .stat-card { padding: var(--space-3) 6px; }
    .stat-card .num { font-size: 1.05rem; }
    .stat-card .lbl { font-size: 0.62rem; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}


/* ==========================================================================
   STYLES LOCAUX DU SITE
   ========================================================================== */

/* ==========================================================================
   Admin · Utilisateurs — uses root design tokens
   ========================================================================== */

/* ALERTS */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    font-size: 0.88rem;
    font-weight: 500;
    animation: fadeIn 0.2s ease;
}
.alert-error {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    color: var(--danger);
}
.alert-success {
    background: color-mix(in srgb, var(--success) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
    color: var(--success);
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* STATS overrides (use auto-fit for users page) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.stat-card .number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}
.stat-card .label {
    color: var(--text-subtle);
    font-size: 0.78rem;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

/* "New user" button block */
.btn-block-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: var(--space-5);
}

/* ---------- Table ---------- */
.users-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
thead tr {
    background: var(--surface-2);
}
th {
    padding: 12px var(--space-4);
    text-align: left;
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr {
    transition: background var(--t-fast);
}
tbody tr:hover { background: var(--surface-hover); }

td.empty-state {
    text-align: center;
    color: var(--text-subtle);
    padding: var(--space-10) var(--space-4);
}

/* Status pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.74rem;
    font-weight: 600;
}
.status-pill.active {
    background: color-mix(in srgb, var(--success) 12%, transparent);
    color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
}
.status-pill.inactive {
    background: color-mix(in srgb, var(--text-faint) 12%, transparent);
    color: var(--text-subtle);
    border: 1px solid var(--border);
}

.perm-tag {
    display: inline-block;
    padding: 1px 8px;
    margin-right: 4px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--accent-bg);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.row-actions { display: flex; gap: 6px; }
.row-actions .btn {
    padding: 5px 10px;
    font-size: 0.78rem;
}

/* ---------- Form card ---------- */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    max-width: 600px;
}
.form-card h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-6);
    color: var(--text);
}

.field { margin-bottom: var(--space-4); }
.field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.field .muted {
    color: var(--text-subtle);
    font-weight: 400;
}
.field-error {
    display: none;
    color: var(--danger);
    font-size: 0.78rem;
    margin-top: 4px;
}
.field-error.visible { display: block; }

.field-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.field-inline label {
    margin-bottom: 0;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
}
.field-inline input[type=checkbox] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}

/* ---------- Modal ---------- */
#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}
#modal-overlay .modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.18s var(--t-base);
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
#modal-overlay h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--space-3);
}
#modal-overlay p {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: var(--space-5);
    line-height: 1.5;
}
.modal-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

/* ---------- Badges (Active/Inactive/Access) ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}
.badge-active {
    color: var(--success);
    background: color-mix(in srgb, var(--success) 12%, transparent);
    border-color: color-mix(in srgb, var(--success) 30%, transparent);
}
.badge-inactive {
    color: var(--text-subtle);
    background: var(--surface-2);
    border-color: var(--border);
}
.badge-access {
    color: var(--accent);
    background: var(--accent-bg);
    border-color: var(--accent-border);
    margin-right: 4px;
}

/* ---------- Actions (per row) ---------- */
.actions-cell { white-space: nowrap; }
.actions {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}
.actions .btn {
    padding: 5px 10px;
    font-size: 0.78rem;
    line-height: 1.2;
    border-radius: var(--radius-sm);
}
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-icon { display: inline-flex; align-items: center; }
.btn-text { display: inline; }
.btn-warning {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}
.btn-warning:hover {
    background: color-mix(in srgb, var(--warning) 85%, white);
    color: white;
    border-color: var(--warning);
}
.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}
.btn-danger:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    border-color: var(--danger);
    color: var(--danger);
}

@media (max-width: 600px) {
    .form-card { padding: var(--space-5); }
}

/* ============================================================================
   STATS CLIQUABLES (filtres par statut)
   ============================================================================ */
.stat-card {
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    font-family: inherit;
    text-align: center;
    transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
    -webkit-tap-highlight-color: transparent;
}
.stat-card:hover { border-color: var(--border-strong); }
.stat-card.active {
    border-color: var(--accent);
    background: var(--accent-bg);
}
.stat-card.active .label { color: var(--accent); }

/* ============================================================================
   BARRE D'OUTILS : recherche + nouvel utilisateur
   ============================================================================ */
.list-toolbar {
    display: flex;
    gap: var(--space-3);
    align-items: stretch;
    margin-bottom: var(--space-4);
}
.search-box {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-subtle);
    pointer-events: none;
}
.search-input {
    width: 100%;
    padding: 10px 36px 10px 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.search-input::placeholder { color: var(--text-faint); }
.search-clear {
    position: absolute;
    right: 8px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all var(--t-fast);
}
.search-clear:hover { color: var(--text); background: var(--surface-3); }
.btn-block-add { flex: 0 0 auto; white-space: nowrap; }

/* ============================================================================
   CARTES-ACCORDÉON (mobile) — masquées sur desktop
   ============================================================================ */
.users-cards { display: none; }

.ucard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
    overflow: hidden;
    transition: border-color var(--t-fast);
}
.ucard.open { border-color: var(--accent); }

/* En-tête (toujours visible) : dot + nom + Éditer + caret */
.ucard-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 14px var(--space-4);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.ucard-status-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ucard-status-dot.on  { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); }
.ucard-status-dot.off { background: var(--text-faint); }
.ucard-name {
    flex: 1;
    min-width: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ucard-edit { flex-shrink: 0; }
.ucard-caret {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform var(--t-base);
}
.ucard.open .ucard-caret { transform: rotate(180deg); color: var(--accent); }

/* Corps déroulant : animé via grid-template-rows (0fr → 1fr).
   Le padding/bordure va sur le wrapper INTERNE pour ne pas casser l'animation. */
.ucard-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--t-base);
}
.ucard.open .ucard-body { grid-template-rows: 1fr; }
.ucard-inner {
    overflow: hidden;
    min-height: 0;
    padding: 0 var(--space-4);
}
.ucard.open .ucard-inner {
    padding-bottom: var(--space-4);
    border-top: 1px solid var(--border);
}

.ucard-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
}
.ucard-row-access { align-items: flex-start; }
.ucard-k {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-subtle);
    flex-shrink: 0;
}
.ucard-v {
    text-align: right;
    color: var(--text);
    font-size: 0.9rem;
}
.ucard-v.cell-id { font-family: var(--font-mono, monospace); color: var(--text-subtle); }
.ucard-row-access .ucard-v {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
}
.ucard-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
}
.ucard-actions .btn {
    flex: 1;
    justify-content: center;
    min-height: 42px;
    font-size: 0.85rem;
}
.ucard-actions .btn-text { display: inline; }

/* ============================================================================
   BASCULE TABLEAU (desktop) ↔ CARTES (mobile)
   ============================================================================ */
@media (max-width: 768px) {
    .users-table-wrap { display: none; }   /* on cache le tableau */
    .users-cards { display: block; }        /* on montre les cartes */

    .list-toolbar { flex-direction: column; }
    .btn-block-add { width: 100%; justify-content: center; min-height: 46px; }

    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
}

/* ============================================================================
   HEADER — menu utilisateur compact (avatar + dropdown)
   Desktop : pill classique + bouton thème (le menu avatar est masqué).
   Mobile  : header 1 ligne, avatar cliquable → menu (nom, thème, logout).
   ============================================================================ */

/* Le menu avatar n'existe que sur mobile : masqué par défaut (desktop) */
.adm-usermenu { display: none; position: relative; }

/* ---------- Avatar (bouton qui ouvre le menu) ---------- */
.adm-avatar {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px 4px 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: border-color var(--t-fast), background var(--t-fast);
}
.adm-avatar:hover,
.adm-avatar.open {
    border-color: var(--accent);
    background: var(--accent-bg);
}
.adm-avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.adm-avatar-caret {
    color: var(--text-muted);
    transition: transform var(--t-base);
}
.adm-avatar.open .adm-avatar-caret { transform: rotate(180deg); color: var(--accent); }

/* ---------- Menu déroulant ---------- */
.adm-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,0.45));
    padding: 6px;
    z-index: 60;
    animation: adm-menu-in 0.16s ease;
    transform-origin: top right;
}
@keyframes adm-menu-in {
    from { opacity: 0; transform: scale(0.96) translateY(-4px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.adm-menu-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}
.adm-menu-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}
.adm-menu-id { display: flex; flex-direction: column; min-width: 0; }
.adm-menu-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.adm-menu-role {
    font-size: 0.72rem;
    color: var(--text-subtle);
}
.adm-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}
.adm-menu-item svg { flex-shrink: 0; color: var(--text-muted); }
.adm-menu-item:hover { background: var(--surface-hover); }
.adm-menu-item:hover svg { color: var(--accent); }
.adm-menu-danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.adm-menu-danger:hover svg { color: var(--danger); }

/* Le toggle thème dans le menu : afficher la bonne icône selon le thème */
.adm-menu-item .icon-sun { display: none; }
:root[data-theme="light"] .adm-menu-item .icon-moon { display: none; }
:root[data-theme="light"] .adm-menu-item .icon-sun  { display: block; }

/* ============================================================================
   BASCULE DESKTOP / MOBILE
   ============================================================================ */
@media (max-width: 768px) {
    /* Header sur une seule ligne, propre */
    .adm-header-inner {
        flex-wrap: nowrap !important;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-3) var(--space-4);
    }

    /* Marque flexible (peut tronquer), garde logo + titre + sous-titre */
    .adm-brand { gap: 10px; flex: 1 1 auto; min-width: 0; overflow: hidden; }
    .adm-brand img {
        width: 42px; height: 42px; padding: 6px;
        border-radius: var(--radius-md);
    }
    .adm-brand > div { min-width: 0; }
    .adm-brand h1 {
        font-size: 1rem; line-height: 1.15;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .adm-brand p {
        font-size: 0.72rem;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }

    .adm-actions { gap: 8px; flex: 0 0 auto; }

    /* On masque l'affichage desktop, on montre le menu avatar */
    .adm-theme-desktop,
    .adm-pill-desktop { display: none !important; }
    .adm-usermenu { display: block; }
}

/* Très petit écran : sous-titre masqué pour donner toute la place au titre */
@media (max-width: 430px) {
    .adm-brand p { display: none; }
    .adm-brand h1 { font-size: 0.95rem; }
    .adm-brand img { width: 38px; height: 38px; padding: 5px; }
    .adm-menu { min-width: 200px; }
}

/* ════════════════════════════════════════════════════════════════════
   PHASE 2 — Poste de pilotage : onglets, profils, habilitations
   ════════════════════════════════════════════════════════════════════ */
.gu-tabs {
    display: flex; gap: var(--space-2);
    margin-bottom: var(--space-5);
    border-bottom: 1px solid var(--border);
    overflow-x: auto; scrollbar-width: none;
}
.gu-tabs::-webkit-scrollbar { display: none; }
.gu-tab {
    flex: 0 0 auto; padding: 10px 16px;
    background: transparent; border: none; border-bottom: 2px solid transparent;
    color: var(--text-muted); font-size: 0.9rem; font-weight: 600;
    font-family: inherit; cursor: pointer; white-space: nowrap;
    transition: color var(--t-fast), border-color var(--t-fast);
}
.gu-tab:hover { color: var(--text); }
.gu-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.gu-panel.hidden { display: none; }
.gu-panel-intro { color: var(--text-muted); font-size: 0.86rem; line-height: 1.5; margin-bottom: var(--space-4); }
.gu-panel-intro b { color: var(--text); }
.form-hint {
    background: var(--accent-bg);
    border: 1px solid var(--accent-border, var(--border));
    border-radius: var(--radius-md);
    padding: 10px 12px; font-size: 0.82rem; color: var(--text-muted);
    line-height: 1.5; margin: var(--space-4) 0;
}
.form-hint b { color: var(--text); }

.gu-cards { display: flex; flex-direction: column; gap: var(--space-2); }
.gu-item {
    display: flex; align-items: center; gap: var(--space-3);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4);
    transition: border-color var(--t-fast);
}
.gu-item:hover { border-color: var(--border-strong, var(--border)); }
.gu-item-main { flex: 1; min-width: 0; }
.gu-item-title { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.gu-item-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.gu-item-meta { font-size: 0.74rem; color: var(--text-subtle); margin-top: 4px; }
.gu-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

.perm-group {
    border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: var(--space-3); margin-bottom: var(--space-3); background: var(--surface-2);
}
.perm-group-title {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--accent); margin-bottom: var(--space-2);
}
.perm-check {
    display: flex; align-items: center; gap: 8px; padding: 7px 6px;
    font-size: 0.86rem; color: var(--text); cursor: pointer; border-radius: var(--radius-sm);
}
.perm-check:hover { background: var(--surface); }
.perm-check input { width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; }

.hab-add-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-4);
}
.hab-add-row { display: flex; gap: var(--space-3); align-items: flex-end; flex-wrap: wrap; }
.hab-add-row .field { flex: 1; min-width: 160px; margin: 0; }
.hab-add-row .btn { flex: 0 0 auto; min-height: 42px; }

@media (max-width: 768px) {
    .hab-add-row { flex-direction: column; align-items: stretch; }
    .hab-add-row .field { min-width: 0; }
    .hab-add-row .btn { width: 100%; }
    .gu-item { flex-wrap: wrap; }
    .gu-item-actions { width: 100%; justify-content: flex-end; }
}
