/* MedNet — Interface professionnelle Fondation SCP */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --green-light: #a8e6cf;
    --green: #5cb88a;
    --blue-light: #b3e5fc;
    --blue: #4fc3f7;
    --white: #ffffff;
    --bg: #f4f8fb;
    --bg-elevated: #ffffff;
    --surface-dark: #0f1419;
    --surface-header: #121820;
    --text: #1a2b3c;
    --text-muted: #5c7080;
    --text-light: #8fa3b3;
    --border: #dce8f0;
    --border-strong: #c5d9e8;
    --shadow-sm: 0 1px 3px rgba(15, 20, 25, 0.06);
    --shadow: 0 8px 32px rgba(15, 20, 25, 0.08);
    --shadow-lg: 0 20px 60px rgba(15, 20, 25, 0.12);
    --radius: 14px;
    --radius-sm: 10px;
    --danger: #e05555;
    --warning: #e6a23c;
    --success: #3dab6a;
    --accent-gradient: linear-gradient(135deg, var(--green-light) 0%, var(--blue-light) 100%);
    --header-height: 72px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(168, 230, 207, 0.25), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(179, 229, 252, 0.2), transparent);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: #0277bd; text-decoration: none; transition: color 0.15s; }
a:hover { color: #01579b; }

/* ── Header ── */
.site-header {
    background: var(--surface-header);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 200;
    backdrop-filter: blur(12px);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.logo:hover { color: var(--white); text-decoration: none; }

.logo img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(168, 230, 207, 0.3));
}

.logo-text span {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-light);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: -2px;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.nav-links > a.nav-item,
.nav-links > a:not(.btn):not(.user-menu-item) {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s;
}

.nav-links > a.nav-item:hover,
.nav-links > a:not(.btn):not(.user-menu-item):hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

/* ── Menu hamburger (tablette / mobile) ── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    cursor: pointer;
    z-index: 210;
}

.nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 180;
    backdrop-filter: blur(2px);
}

body.nav-open { overflow: hidden; }

/* ── User menu dropdown ── */
.user-menu {
    position: relative;
    margin-left: 0.5rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.35rem 0.75rem 0.35rem 0.4rem;
    border-radius: 999px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.user-menu-toggle:hover,
.user-menu.is-open .user-menu-toggle {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(168, 230, 207, 0.35);
}

.user-badge img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(168, 230, 207, 0.4);
    flex-shrink: 0;
}

.user-badge-initial {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}

.user-menu-chevron {
    flex-shrink: 0;
    opacity: 0.65;
    transition: transform 0.2s;
}

.user-menu.is-open .user-menu-chevron {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    z-index: 300;
}

.user-menu.is-open .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    padding: 0.65rem 0.85rem 0.75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.35rem;
}

.user-menu-header strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.15rem;
}

.user-menu-header span {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.user-menu-item {
    display: block;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text) !important;
    text-decoration: none !important;
    transition: background 0.15s;
}

.user-menu-item:hover {
    background: rgba(168, 230, 207, 0.2);
    color: var(--text) !important;
}

.user-menu-logout {
    color: var(--danger) !important;
}

.user-menu-logout:hover {
    background: #fdf0f0 !important;
    color: var(--danger) !important;
}

.user-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.35rem 0;
}

/* ── Main ── */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2.5rem 2rem 4rem;
    min-height: calc(100vh - var(--header-height) - 80px);
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 640px;
}

/* ── Cards ── */
.card {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.card-narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.card-medium { max-width: 640px; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--green) 0%, #3da88a 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(92, 184, 138, 0.35);
}

.btn-primary:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(92, 184, 138, 0.4);
    color: var(--white);
    text-decoration: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #5eb8e8 0%, var(--blue) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(79, 195, 247, 0.3);
}

.btn-secondary:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    color: var(--white);
    text-decoration: none;
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 14px rgba(224, 85, 85, 0.3);
}

.btn-danger:hover { filter: brightness(1.08); color: white; text-decoration: none; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-strong);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--green);
    background: rgba(168, 230, 207, 0.15);
    text-decoration: none;
    color: var(--text);
}

.btn-discord {
    background: #5865F2;
    color: white;
    font-size: 0.95rem;
    padding: 0.85rem 1.75rem;
    box-shadow: 0 4px 16px rgba(88, 101, 242, 0.4);
}

.btn-discord:hover {
    background: #4752c4;
    transform: translateY(-1px);
    color: white;
    text-decoration: none;
}

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }

.btn-group { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ── Forms ── */
.form-group { margin-bottom: 1.35rem; }

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.45rem;
    font-size: 0.875rem;
    color: var(--text);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--white);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(168, 230, 207, 0.45);
}

textarea.form-control { min-height: 120px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

/* ── Alerts ── */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background: #edf7f0;
    border: 1px solid #b8e0c8;
    color: #1b6b3a;
}

.alert-error {
    background: #fdf0f0;
    border: 1px solid #f0b8b8;
    color: #9b2222;
}

.alert-info {
    background: #eef7fc;
    border: 1px solid #b8dff0;
    color: #0d5f8a;
}

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th, .table td {
    padding: 0.9rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: #f8fbfd;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover td { background: rgba(168, 230, 207, 0.08); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent-gradient);
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--green) 0%, #0288d1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* ── Hero (landing) ── */
.hero {
    text-align: center;
    padding: 3rem 1rem 4rem;
    max-width: 720px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    background: var(--accent-gradient);
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    margin-bottom: 1.25rem;
}

.hero h1 {
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 1rem;
    line-height: 1.15;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.hero-link {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    max-width: 900px;
    margin: 0 auto;
}

.feature-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.feature-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 1rem;
    background: var(--accent-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── Auth panel ── */
.auth-panel {
    max-width: 440px;
    margin: 2rem auto;
}

.auth-panel .card {
    text-align: center;
    padding: 2.5rem 2rem;
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-panel .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

/* ── Character cards ── */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.character-card {
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.character-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.2s;
}

.character-card:hover {
    border-color: var(--green);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.character-card:hover::before { opacity: 1; }

.character-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.character-card .ident {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.server-tag {
    display: inline-block;
    background: linear-gradient(135deg, rgba(168,230,207,0.4), rgba(179,229,252,0.4));
    border: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #1a5270;
}

.character-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 auto 1rem;
}

/* ── Medical records ── */
.record-identity {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.identity-item {
    padding: 1rem;
    background: #f8fbfd;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.identity-item .label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.identity-item .value { font-weight: 600; font-size: 0.95rem; }

.entry-block {
    border-left: 4px solid var(--green);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    background: #f8fbfd;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border: 1px solid var(--border);
    border-left-width: 4px;
}

.entry-block.hospitalisation { border-left-color: var(--danger); }
.entry-block.psychologique { border-left-color: #8e7cc3; }
.entry-block.travail { border-left-color: var(--blue); }

.entry-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* ── Consent ── */
.consent-box {
    max-width: 520px;
    margin: 2rem auto;
    text-align: center;
}

.consent-box h2 { font-size: 1.35rem; margin-bottom: 0.75rem; }
.consent-box p { color: var(--text-muted); margin-bottom: 1.5rem; }
.consent-actions { display: flex; flex-direction: column; gap: 0.85rem; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-green { background: #e0f5ea; color: #1b6b3a; border: 1px solid #b8e0c8; }
.badge-blue { background: #e3f4fc; color: #0277bd; border: 1px solid #b8dff0; }

/* ── Search ── */
.search-bar { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; }
.search-bar .form-control { flex: 1; }

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* ── Footer ── */
.site-footer {
    background: var(--surface-header);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
    padding: 1.5rem 2rem;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.82rem;
}

.site-footer strong { color: rgba(255, 255, 255, 0.65); }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .nav-toggle { display: flex; }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: min(320px, 88vw);
        height: 100vh;
        height: 100dvh;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        padding: calc(var(--header-height) + 1rem) 1.25rem 1.5rem;
        background: var(--surface-header);
        border-left: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.35);
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 190;
        overflow-y: auto;
    }

    .nav-links.is-open {
        transform: translateX(0);
    }

    .nav-links > a.nav-item,
    .nav-links > a:not(.btn) {
        padding: 0.85rem 1rem;
        font-size: 1rem;
        border-radius: var(--radius-sm);
    }

    .nav-links .btn-discord {
        width: 100%;
        margin-top: 0.5rem;
        justify-content: center;
    }

    .user-menu {
        margin-left: 0;
        margin-top: auto;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .user-menu-toggle {
        width: 100%;
        justify-content: flex-start;
        border-radius: var(--radius-sm);
        padding: 0.65rem 0.85rem;
    }

    .user-menu-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0.5rem 0 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

    .user-menu.is-open .user-menu-dropdown {
        max-height: 280px;
        padding: 0.5rem 0 0;
    }

    .user-menu-header {
        background: rgba(255, 255, 255, 0.06);
        border-radius: var(--radius-sm);
        border-bottom: none;
    }

    .user-menu-header strong { color: var(--white); }
    .user-menu-header span { color: rgba(255, 255, 255, 0.55); }

    .user-menu-item {
        color: rgba(255, 255, 255, 0.85) !important;
        padding: 0.75rem 1rem;
    }

    .user-menu-item:hover {
        background: rgba(255, 255, 255, 0.08) !important;
        color: var(--white) !important;
    }

    .user-menu-logout {
        color: #f08080 !important;
    }

    .user-menu-logout:hover {
        background: rgba(224, 85, 85, 0.15) !important;
        color: #ff9999 !important;
    }

    .user-menu-divider {
        background: rgba(255, 255, 255, 0.1);
    }
}

@media (max-width: 768px) {
    .header-inner { padding: 0 1rem; }
    .main-content { padding: 1.5rem 1rem 3rem; }
    .hero h1 { font-size: 2rem; }
    .form-row { grid-template-columns: 1fr; }
    .page-title { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .logo-text span { display: none; }
    .user-badge-name {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ── Icons ── */
.icon {
    flex-shrink: 0;
    vertical-align: middle;
}

.icon-sm { width: 16px !important; height: 16px !important; }
.icon-lg { width: 28px !important; height: 28px !important; }
.icon-xl { width: 48px !important; height: 48px !important; opacity: 0.45; }

.card-title .icon,
.admin-tab .icon {
    margin-right: 0;
}

.btn .icon {
    display: inline-block;
    vertical-align: -0.2em;
    margin-right: 0.35rem;
}

.btn .icon:last-child { margin-right: 0; margin-left: 0.35rem; }
.btn .icon:only-child { margin: 0; }

.icon-discord { flex-shrink: 0; }

/* ── Brand logo ── */
.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    overflow: hidden;
}

.brand-logo img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
}

.brand-logo--hero {
    width: 140px;
    height: 140px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 10px 28px rgba(15, 20, 25, 0.18));
}

.brand-logo--auth {
    width: 96px;
    height: 96px;
    margin-bottom: 1.5rem;
}

.brand-logo--sm {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
}

.btn-block { width: 100%; }

.auth-footer-link {
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

.form-control-code {
    text-align: center;
    font-size: 1.15rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 600;
}

/* ── Admin / Servers ── */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted) !important;
    margin-bottom: 0.75rem;
}

.back-link:hover { color: var(--text) !important; }

.stats-grid--compact {
    margin-bottom: 1.5rem;
}

.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.server-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.server-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.server-card--inactive {
    opacity: 0.72;
    background: #f8fafb;
}

.server-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.server-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.server-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.server-card-slug {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
}

.server-card-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
}

.server-card-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.metric {
    text-align: center;
}

.metric-value {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.metric-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.admin-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted) !important;
    text-decoration: none !important;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

.admin-tab:hover { color: var(--text) !important; }

.admin-tab.is-active {
    color: var(--text) !important;
    border-bottom-color: var(--green);
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.member-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fbfd;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 1;
    min-width: 0;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.member-avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.member-info strong {
    display: block;
    font-size: 0.9rem;
}

.member-discord {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.member-role-form {
    min-width: 160px;
}

.form-control-sm {
    padding: 0.45rem 0.65rem;
    font-size: 0.85rem;
}

.btn-icon {
    padding: 0.5rem;
    min-width: 38px;
    min-height: 38px;
}

.btn-danger-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--danger);
}

.btn-danger-ghost:hover {
    background: #fdf0f0;
    border-color: #f0b8b8;
    color: var(--danger);
}

.badge-muted {
    background: #eef2f5;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.badge .icon {
    vertical-align: -0.15em;
    margin-right: 0.25rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
}

.empty-state--compact {
    padding: 2rem 1rem;
}

.empty-state h3 {
    color: var(--text);
    margin-bottom: 0.5rem;
}

@media (max-width: 640px) {
    .server-card-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .member-row {
        flex-wrap: wrap;
    }

    .member-role-form {
        width: 100%;
        min-width: 0;
    }

    .admin-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
