
:root {
    --bg: #0b0d12;
    --bg-soft: #10131a;
    --surface: #151922;
    --surface-2: #1a1f2a;
    --surface-3: #202633;
    --surface-hover: #252c3a;
    --input: #10141c;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.13);
    --text: #f7f8fb;
    --text-soft: #c3c9d5;
    --muted: #8d96a8;
    --dim: #697386;
    --primary: #7c6df2;
    --primary-strong: #6959e8;
    --primary-soft: rgba(124, 109, 242, 0.14);
    --primary-border: rgba(124, 109, 242, 0.35);
    --purple: #a673f3;
    --green: #35c98b;
    --green-soft: rgba(53, 201, 139, 0.12);
    --yellow: #f0b95d;
    --yellow-soft: rgba(240, 185, 93, 0.13);
    --red: #ef6574;
    --red-soft: rgba(239, 101, 116, 0.12);
    --discord: #5865f2;
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.18);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.34);
    --transition: 180ms ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

[hidden] {
    display: none !important;
}

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% -5%, rgba(124, 109, 242, 0.16), transparent 34%),
        radial-gradient(circle at 95% 100%, rgba(75, 199, 170, 0.07), transparent 30%),
        var(--bg);
    color: var(--text);
    font-family: 'Manrope', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

svg {
    display: block;
    width: 1.2em;
    height: 1.2em;
    fill: currentColor;
}

code {
    padding: 0.12rem 0.38rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    color: #d9dcff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.86em;
    word-break: break-all;
}

/* Top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 72px;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 13, 18, 0.82);
    backdrop-filter: blur(18px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.72rem;
    color: var(--text);
    text-decoration: none;
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border: 1px solid var(--primary-border);
    border-radius: 11px;
    background: linear-gradient(145deg, rgba(124, 109, 242, 0.2), rgba(124, 109, 242, 0.07));
    color: #a99ffb;
    display: grid;
    place-items: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.brand-mark svg {
    width: 21px;
    height: 21px;
}

.brand-badge {
    padding: 0.28rem 0.56rem;
    border: 1px solid var(--primary-border);
    border-radius: 999px;
    background: var(--primary-soft);
    color: #bcb5ff;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.account-menu,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.account-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.account-copy strong {
    font-size: 0.87rem;
}

.account-copy span,
.topbar-note {
    color: var(--muted);
    font-size: 0.75rem;
}

.topbar-note {
    display: flex;
    align-items: center;
    gap: 0.48rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(124, 109, 242, 0.45);
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-2);
}

.selected-context {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.72rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.selected-context .context-label {
    color: var(--muted);
    font-size: 0.72rem;
}

.selected-context strong {
    font-size: 0.82rem;
}

.presence-inline,
.presence-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dim);
    box-shadow: 0 0 0 3px rgba(105, 115, 134, 0.12);
}

.presence-inline.online,
.presence-dot.online {
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(53, 201, 139, 0.13);
}

.presence-inline.offline,
.presence-dot.offline {
    background: var(--red);
    box-shadow: 0 0 0 3px rgba(239, 101, 116, 0.12);
}

/* Buttons */
.btn {
    min-height: 42px;
    padding: 0.68rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.58rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
    transition: transform var(--transition), background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition);
}

.btn svg {
    width: 17px;
    height: 17px;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:focus-visible,
.form-input:focus-visible,
.custom-dropdown-btn:focus-visible,
.sidebar-btn:focus-visible,
.filter-chip:focus-visible,
.icon-btn:focus-visible,
.copy-btn:focus-visible {
    outline: 2px solid rgba(124, 109, 242, 0.8);
    outline-offset: 2px;
}

.btn:disabled {
    cursor: wait;
    opacity: 0.6;
}

.btn-primary {
    border-color: rgba(145, 132, 255, 0.45);
    background: linear-gradient(135deg, #8172f5, #6d5de9);
    box-shadow: 0 10px 22px rgba(89, 73, 212, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #8b7cf8, #7565ed);
}

.btn-invite {
    border-color: rgba(88, 101, 242, 0.45);
    background: linear-gradient(135deg, #5865f2, #4752c4);
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(88, 101, 242, 0.25);
}

.btn-invite:hover:not(:disabled) {
    background: linear-gradient(135deg, #6775f4, #505dc9);
    color: #ffffff;
}

.btn-secondary {
    border-color: var(--border-strong);
    background: var(--surface-2);
    color: var(--text-soft);
}

.btn-secondary:hover:not(:disabled) {
    border-color: rgba(124, 109, 242, 0.35);
    background: var(--surface-hover);
    color: var(--text);
}

.btn-ghost {
    border-color: var(--border);
    background: transparent;
    color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
}

.btn-danger-soft {
    border-color: rgba(239, 101, 116, 0.24);
    background: var(--red-soft);
    color: #ff9daa;
}

.btn-danger-soft:hover:not(:disabled) {
    border-color: rgba(239, 101, 116, 0.42);
    background: rgba(239, 101, 116, 0.18);
}

.btn-discord {
    min-height: 50px;
    border-color: rgba(124, 137, 255, 0.5);
    background: var(--discord);
    box-shadow: 0 12px 28px rgba(88, 101, 242, 0.25);
}

.btn-discord:hover {
    background: #6571f4;
}

.btn-sm {
    min-height: 36px;
    padding: 0.54rem 0.78rem;
    font-size: 0.78rem;
}

.btn-block {
    width: 100%;
}

/* Shared shells */
.page-shell {
    width: min(1220px, calc(100% - 2.5rem));
    margin: 0 auto;
}

.eyebrow,
.panel-kicker,
.login-kicker {
    color: #a89fff;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* Login */
.login-page {
    background:
        radial-gradient(circle at 18% 22%, rgba(124, 109, 242, 0.2), transparent 30%),
        radial-gradient(circle at 80% 75%, rgba(60, 193, 155, 0.08), transparent 26%),
        var(--bg);
}

.login-shell {
    width: min(1180px, calc(100% - 2.5rem));
    min-height: calc(100vh - 72px);
    margin: 0 auto;
    padding: 4.5rem 0;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
    align-items: center;
    gap: clamp(3rem, 7vw, 7rem);
}

.login-copy h1 {
    max-width: 720px;
    margin-top: 1rem;
    font-size: clamp(2.6rem, 5vw, 4.8rem);
    line-height: 1.02;
    letter-spacing: -0.055em;
}

.login-copy > p {
    max-width: 620px;
    margin-top: 1.35rem;
    color: var(--text-soft);
    font-size: 1.05rem;
    line-height: 1.75;
}

.login-features {
    margin-top: 2.4rem;
    display: grid;
    gap: 0.9rem;
}

.login-features > div {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.login-features > div > span {
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
}

.login-features strong {
    display: block;
    font-size: 0.95rem;
}

.login-features p {
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.login-card-wrap {
    position: relative;
}

.login-card-wrap::before {
    content: '';
    position: absolute;
    inset: 10% -8%;
    border-radius: 50%;
    background: rgba(124, 109, 242, 0.12);
    filter: blur(55px);
    pointer-events: none;
}

.login-card {
    position: relative;
    padding: 2rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    background: linear-gradient(165deg, rgba(28, 33, 45, 0.96), rgba(18, 22, 30, 0.96));
    box-shadow: var(--shadow-lg);
}

.login-icon {
    width: 58px;
    height: 58px;
    margin-bottom: 1.4rem;
    border: 1px solid var(--primary-border);
    border-radius: 18px;
    background: var(--primary-soft);
    color: #b3aaff;
    display: grid;
    place-items: center;
}

.login-icon svg {
    width: 30px;
    height: 30px;
}

.login-card h2 {
    margin-top: 0.45rem;
    font-size: 1.65rem;
    letter-spacing: -0.03em;
}

.login-card > p {
    margin: 0.8rem 0 1.5rem;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.7;
}

.login-security-note {
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.55;
}

.login-security-note svg {
    width: 17px;
    min-width: 17px;
    color: var(--green);
}

/* Pickers */
.picker-shell {
    padding: 3.3rem 0 5rem;
}

.picker-hero {
    max-width: 760px;
    margin: 0 auto 2.5rem;
    text-align: center;
}

.picker-hero h1 {
    margin-top: 0.65rem;
    font-size: clamp(2rem, 4vw, 3.15rem);
    line-height: 1.1;
    letter-spacing: -0.045em;
}

.picker-hero > p {
    max-width: 680px;
    margin: 0.9rem auto 0;
    color: var(--muted);
    line-height: 1.7;
}

.steps {
    max-width: 520px;
    margin: 2rem auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step {
    min-width: 80px;
    color: var(--dim);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.38rem;
    font-size: 0.72rem;
}

.step span {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: var(--surface);
    display: grid;
    place-items: center;
    font-weight: 800;
}

.step.active,
.step.complete {
    color: var(--text-soft);
}

.step.active span {
    border-color: var(--primary-border);
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 5px rgba(124, 109, 242, 0.1);
}

.step.complete span {
    border-color: rgba(53, 201, 139, 0.35);
    background: var(--green-soft);
    color: var(--green);
}

.step-line {
    width: 80px;
    height: 1px;
    margin-bottom: 1.35rem;
    background: var(--border-strong);
}

.step-line.complete {
    background: rgba(53, 201, 139, 0.38);
}

.picker-toolbar {
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.search-field {
    min-height: 46px;
    width: min(100%, 540px);
    padding: 0 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-field:focus-within {
    border-color: var(--primary-border);
    box-shadow: 0 0 0 4px rgba(124, 109, 242, 0.07);
}

.search-field svg {
    width: 18px;
    min-width: 18px;
    color: var(--dim);
}

.search-field input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.88rem;
}

.search-field input::placeholder {
    color: var(--dim);
}

.search-field.compact {
    min-height: 42px;
    width: min(100%, 360px);
}

.result-count {
    color: var(--muted);
    font-size: 0.8rem;
}

.result-count strong {
    color: var(--text);
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.picker-card {
    min-height: 310px;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: linear-gradient(155deg, rgba(24, 29, 40, 0.96), rgba(18, 22, 30, 0.95));
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.picker-card:hover {
    transform: translateY(-3px);
    border-color: rgba(124, 109, 242, 0.3);
    background: linear-gradient(155deg, rgba(28, 34, 46, 0.98), rgba(20, 24, 33, 0.98));
}

.picker-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.bot-avatar,
.guild-avatar {
    width: 58px;
    height: 58px;
    border: 1px solid var(--border-strong);
    border-radius: 17px;
    background: var(--surface-3);
    object-fit: cover;
}

.bot-avatar {
    position: relative;
    display: grid;
    place-items: center;
    color: #b2a9ff;
}

.bot-avatar svg {
    width: 30px;
    height: 30px;
}

.bot-avatar .presence-dot {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 11px;
    height: 11px;
    border: 3px solid var(--surface);
    box-sizing: content-box;
}

.guild-fallback {
    display: grid;
    place-items: center;
    color: var(--text-soft);
    font-size: 1rem;
    font-weight: 800;
}

.status-badge,
.permission-badge,
.status-pill,
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.42rem;
    padding: 0.3rem 0.58rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-badge > span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.online,
.permission-badge.admin,
.status-pill.active {
    border-color: rgba(53, 201, 139, 0.25);
    background: var(--green-soft);
    color: #66dca9;
}

.status-badge.offline,
.status-pill.inactive {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
}

.permission-badge.owner {
    border-color: var(--primary-border);
    background: var(--primary-soft);
    color: #b9b1ff;
}

.picker-card-body {
    margin-top: 1.15rem;
}

.picker-card-body h2 {
    font-size: 1.08rem;
    letter-spacing: -0.025em;
    word-break: break-word;
}

.picker-card-body p {
    margin-top: 0.42rem;
    color: var(--muted);
    font-size: 0.79rem;
    line-height: 1.6;
}

.card-meta-row {
    margin: 1.15rem 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--muted);
    font-size: 0.72rem;
}

.card-meta-row code {
    max-width: 68%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.picker-card .btn {
    margin-top: auto;
}

.empty-state,
.empty-search {
    padding: 3.5rem 1.5rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: rgba(21, 25, 34, 0.68);
    text-align: center;
}

.empty-state {
    max-width: 680px;
    margin: 0 auto;
}

.empty-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 1rem;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-2);
    color: var(--muted);
    display: grid;
    place-items: center;
    font-size: 1.55rem;
}

.empty-icon svg {
    width: 28px;
    height: 28px;
}

.empty-state h2,
.empty-search h2 {
    font-size: 1.15rem;
}

.empty-state p,
.empty-search p {
    margin: 0.5rem auto 1.2rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.command-hint {
    display: inline-flex;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input);
}

/* Dashboard layout */
.dashboard-shell {
    width: min(1540px, calc(100% - 2.25rem));
    margin: 0 auto;
    padding: 1.4rem 0 3rem;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    gap: 1.35rem;
}

.dashboard-sidebar {
    position: sticky;
    top: 88px;
    height: calc(100vh - 104px);
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(18, 22, 30, 0.86);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.sidebar-context-card {
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.context-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.context-guild-avatar {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-strong);
    border-radius: 13px;
    object-fit: cover;
    flex: 0 0 auto;
}

.context-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.context-copy span,
.bot-context-line span,
.sidebar-security-note span {
    color: var(--muted);
    font-size: 0.65rem;
}

.context-copy strong {
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
}

.context-divider {
    height: 1px;
    margin: 0.75rem 0;
    background: var(--border);
}

.bot-context-line {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.bot-context-line > div {
    display: flex;
    flex-direction: column;
}

.bot-context-line strong {
    font-size: 0.76rem;
}

.sidebar-label {
    margin: 1.15rem 0.7rem 0.55rem;
    color: var(--dim);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: grid;
    gap: 0.3rem;
}

.sidebar-btn {
    width: 100%;
    min-height: 43px;
    padding: 0.65rem 0.72rem;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.68rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.sidebar-btn svg {
    width: 17px;
    min-width: 17px;
}

.sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-soft);
}

.sidebar-btn.active {
    border-color: rgba(124, 109, 242, 0.22);
    background: var(--primary-soft);
    color: #c6c0ff;
}

.sidebar-btn > span:nth-child(2) {
    flex: 1;
}

.nav-count {
    min-width: 22px;
    height: 20px;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-soft);
    display: grid;
    place-items: center;
    font-size: 0.64rem;
}

.nav-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dim);
}

.nav-dot.active {
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(53, 201, 139, 0.12);
}

.sidebar-security-note {
    margin-top: auto;
    padding: 0.75rem;
    border: 1px solid rgba(53, 201, 139, 0.16);
    border-radius: var(--radius-sm);
    background: rgba(53, 201, 139, 0.055);
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.sidebar-security-note svg {
    width: 17px;
    min-width: 17px;
    color: var(--green);
}

.sidebar-security-note > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-security-note strong {
    font-size: 0.7rem;
}

.sidebar-security-note code {
    display: inline-block;
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.dashboard-main {
    min-width: 0;
}

.tab-pane {
    animation: tabIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-pane.slide-from-right {
    animation: slideInRight 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-pane.slide-from-left {
    animation: slideInLeft 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tabIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(28px) scale(0.995);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-28px) scale(0.995);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.content-header {
    min-height: 114px;
    margin-bottom: 1rem;
    padding: 0.4rem 0.25rem 0.8rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
}

.content-header h1 {
    margin-top: 0.35rem;
    font-size: clamp(1.65rem, 3vw, 2.35rem);
    letter-spacing: -0.045em;
}

.content-header p {
    margin-top: 0.45rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.content-header p strong {
    color: var(--text-soft);
}

.header-status {
    align-self: center;
}

.panel-card {
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: linear-gradient(155deg, rgba(22, 27, 37, 0.95), rgba(17, 21, 29, 0.94));
    box-shadow: var(--shadow-sm);
}

.panel-heading {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.panel-heading h2 {
    margin-top: 0.2rem;
    font-size: 1.03rem;
    letter-spacing: -0.02em;
}

.panel-intro {
    margin: -0.2rem 0 1rem;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.6;
}

/* Overview */
.stats-grid {
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
}

.stat-card {
    position: relative;
    min-height: 145px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    width: 90px;
    height: 90px;
    right: -30px;
    top: -35px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.045;
}

.stat-card.primary { color: #b4abff; }
.stat-card.success { color: #72ddaD; }
.stat-card.purple { color: #c296ff; }
.stat-card.neutral { color: #aeb6c5; }

.stat-icon {
    width: 34px;
    height: 34px;
    border: 1px solid currentColor;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
    display: grid;
    place-items: center;
    opacity: 0.9;
}

.stat-icon svg {
    width: 18px;
    height: 18px;
}

.stat-copy {
    margin-top: 1rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.6rem;
}

.stat-copy span {
    color: var(--muted);
    font-size: 0.7rem;
}

.stat-copy strong {
    color: var(--text);
    font-size: 1.55rem;
    line-height: 1;
}

.stat-copy strong small {
    margin-left: 0.2rem;
    color: var(--dim);
    font-size: 0.7rem;
}

.stat-copy .status-text {
    font-size: 0.95rem;
}

.status-text.online { color: var(--green); }
.status-text.offline { color: var(--red); }

.stat-progress {
    height: 4px;
    margin-top: 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.stat-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.stat-foot {
    display: block;
    margin-top: 1rem;
    color: var(--dim);
    font-size: 0.64rem;
}

.overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    gap: 1rem;
}

.protection-list {
    display: grid;
    gap: 0.45rem;
}

.protection-row {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.protection-row:hover {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.025);
}

.mini-module-icon {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: #aaa1ff;
    display: grid;
    place-items: center;
}

.mini-module-icon svg {
    width: 17px;
    height: 17px;
}

.protection-name {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.protection-name strong {
    font-size: 0.78rem;
}

.protection-name small {
    color: var(--muted);
    font-size: 0.64rem;
}

.context-details {
    display: grid;
}

.context-details > div {
    min-height: 48px;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.context-details > div:last-child {
    border-bottom: 0;
}

.context-details dt {
    color: var(--muted);
    font-size: 0.7rem;
}

.context-details dd {
    max-width: 72%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    font-size: 0.76rem;
    font-weight: 700;
    text-align: right;
}

.copy-btn {
    padding: 0.25rem 0.42rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-size: 0.6rem;
    cursor: pointer;
}

.copy-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.safe-context-note,
.hierarchy-note {
    margin-top: 1rem;
    padding: 0.75rem;
    border: 1px solid rgba(53, 201, 139, 0.15);
    border-radius: var(--radius-sm);
    background: rgba(53, 201, 139, 0.05);
    color: var(--muted);
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.7rem;
    line-height: 1.55;
}

.safe-context-note svg,
.hierarchy-note svg {
    width: 16px;
    min-width: 16px;
    color: var(--green);
}

.hierarchy-note strong {
    color: var(--text-soft);
}

/* Modules */
.modules-panel {
    padding: 1rem;
}

.module-toolbar {
    margin-bottom: 1rem;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.filter-chips {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.filter-chip {
    min-height: 34px;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 750;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.filter-chip:hover,
.filter-chip.active {
    border-color: var(--primary-border);
    background: var(--primary-soft);
    color: #c0baff;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.module-card {
    min-height: 315px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(13, 17, 24, 0.55);
    display: flex;
    flex-direction: column;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: rgba(124, 109, 242, 0.25);
    background: rgba(19, 24, 33, 0.82);
}

.module-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.module-icon,
.setting-icon,
.access-icon,
.member-avatar {
    display: grid;
    place-items: center;
}

.module-icon {
    width: 40px;
    height: 40px;
    border: 1px solid var(--primary-border);
    border-radius: 12px;
    background: var(--primary-soft);
    color: #aea5ff;
}

.module-icon.large {
    width: 46px;
    height: 46px;
    border-radius: 14px;
}

.module-icon svg {
    width: 19px;
    height: 19px;
}

.module-card-copy {
    margin-top: 0.9rem;
}

.module-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.module-title-row h2 {
    font-size: 0.92rem;
    letter-spacing: -0.02em;
}

.module-category {
    display: inline-block;
    margin-top: 0.18rem;
    color: #9d94f4;
    font-size: 0.61rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.module-card-copy p {
    min-height: 40px;
    margin-top: 0.65rem;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.55;
}

.module-meta {
    margin: 0.9rem 0;
    padding: 0.65rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.module-meta span {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.module-meta small {
    color: var(--dim);
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.module-meta strong {
    margin-top: 0.18rem;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 0.64rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.module-card > .btn {
    margin-top: auto;
}

.modules-empty {
    margin-top: 0.75rem;
}

/* Switch */
.switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex: 0 0 auto;
}

.switch.large {
    width: 48px;
    height: 28px;
}

.switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.slider {
    position: absolute;
    inset: 0;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: #343b49;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #dce0e8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: transform var(--transition), background var(--transition);
}

.switch.large .slider::before {
    width: 20px;
    height: 20px;
}

.switch input:checked + .slider {
    border-color: rgba(124, 109, 242, 0.65);
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 109, 242, 0.08);
}

.switch input:checked + .slider::before {
    transform: translateX(18px);
    background: white;
}

.switch.large input:checked + .slider::before {
    transform: translateX(20px);
}

.switch input:focus-visible + .slider {
    outline: 2px solid rgba(124, 109, 242, 0.8);
    outline-offset: 2px;
}

/* Forms and settings */
.settings-card {
    max-width: 850px;
}

.setting-toggle-row {
    margin-bottom: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.025);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.setting-leading {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.setting-icon {
    width: 42px;
    height: 42px;
    border: 1px solid var(--primary-border);
    border-radius: 13px;
    background: var(--primary-soft);
    color: #aea5ff;
}

.setting-icon svg {
    width: 20px;
    height: 20px;
}

.setting-toggle-row h2,
.setting-toggle-row h3 {
    font-size: 0.9rem;
}

.setting-toggle-row p {
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.7rem;
}

.form-grid {
    display: grid;
    gap: 0.9rem;
}

.form-grid.two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.28rem;
    color: var(--text-soft);
    font-size: 0.76rem;
    font-weight: 750;
}

.form-desc {
    margin-bottom: 0.55rem;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.5;
}

.form-input {
    width: 100%;
    min-height: 44px;
    padding: 0.68rem 0.82rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: 0;
    background: var(--input);
    color: var(--text);
    font-size: 0.8rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder {
    color: var(--dim);
}

.form-input:focus {
    border-color: var(--primary-border);
    box-shadow: 0 0 0 4px rgba(124, 109, 242, 0.07);
}

.form-actions {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.form-security-hint {
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.66rem;
}

.form-security-hint svg {
    width: 15px;
    color: var(--green);
}

/* Custom dropdown */
.custom-dropdown {
    position: relative;
}

.custom-dropdown-btn {
    width: 100%;
    min-height: 44px;
    padding: 0.68rem 0.82rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input);
    color: var(--text-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.custom-dropdown-btn:hover,
.custom-dropdown.open .custom-dropdown-btn {
    border-color: var(--primary-border);
    background: #141923;
}

.custom-dropdown-btn svg {
    width: 17px;
    color: var(--muted);
    transition: transform var(--transition);
}

.custom-dropdown.open .custom-dropdown-btn svg {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    z-index: 80;
    top: calc(100% + 7px);
    left: 0;
    right: 0;
    padding: 0.35rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #171c26;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
    display: none;
}

.custom-dropdown.open .custom-dropdown-menu {
    display: grid;
    animation: dropdownIn 120ms ease;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-dropdown-item {
    width: 100%;
    min-height: 38px;
    padding: 0.56rem 0.65rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}

.custom-dropdown-item:hover {
    background: rgba(124, 109, 242, 0.1);
    color: var(--text);
}

.custom-dropdown-item.danger {
    color: #ff9daa;
}

.custom-dropdown-item.stacked,
.custom-dropdown-item:has(small) {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.12rem;
}

.custom-dropdown-item small {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 500;
}

/* Multi-select bypass */
.multi-select-menu {
    gap: 0.25rem;
}

.multi-select-option {
    position: relative;
    min-height: 54px;
    padding: 0.62rem 0.68rem;
    border-radius: 9px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.6rem;
    color: var(--text-soft);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.multi-select-option:hover {
    background: rgba(124, 109, 242, 0.1);
    color: var(--text);
}

.multi-select-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.multi-select-check {
    width: 21px;
    height: 21px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--input);
    display: grid;
    place-items: center;
    color: transparent;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.multi-select-check svg {
    width: 14px;
    height: 14px;
}

.multi-select-option input:checked + .multi-select-check {
    border-color: var(--primary-border);
    background: var(--primary);
    color: white;
}

.multi-select-option input:focus-visible + .multi-select-check {
    outline: 2px solid rgba(124, 109, 242, 0.8);
    outline-offset: 2px;
}

.multi-select-option > span:last-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.multi-select-option strong {
    font-size: 0.72rem;
}

.multi-select-option small {
    color: var(--muted);
    font-size: 0.62rem;
}

/* Prefix editor */
.prefix-manager {
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.018);
}

.prefix-chip-list {
    min-height: 43px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.prefix-chip {
    min-height: 34px;
    padding: 0.38rem 0.5rem 0.38rem 0.65rem;
    border: 1px solid var(--primary-border);
    border-radius: 10px;
    background: var(--primary-soft);
    color: #c6c0ff;
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.prefix-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(124, 109, 242, 0.58);
    background: rgba(124, 109, 242, 0.2);
}

.prefix-chip code {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 0.78rem;
    font-weight: 800;
}

.prefix-chip span {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1;
}

.prefix-add-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
}

.prefix-footer {
    margin-top: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.64rem;
}

.prefix-footer strong {
    color: #bcb5ff;
}

/* Access management */
.access-warning {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(240, 185, 93, 0.2);
    border-radius: var(--radius-md);
    background: var(--yellow-soft);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.warning-icon {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(240, 185, 93, 0.25);
    border-radius: 10px;
    color: var(--yellow);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.warning-icon svg {
    width: 18px;
}

.access-warning strong {
    font-size: 0.78rem;
}

.access-warning p {
    margin-top: 0.18rem;
    color: #b8a78a;
    font-size: 0.7rem;
    line-height: 1.55;
}

.access-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.access-card {
    display: flex;
    flex-direction: column;
}

.access-title-group {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.access-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
}

.access-icon svg {
    width: 19px;
}

.access-icon.owner {
    border: 1px solid rgba(53, 201, 139, 0.25);
    background: var(--green-soft);
    color: var(--green);
}

.access-icon.whitelist {
    border: 1px solid var(--primary-border);
    background: var(--primary-soft);
    color: #aea5ff;
}

.count-badge {
    min-width: 30px;
    border-color: rgba(53, 201, 139, 0.22);
    background: var(--green-soft);
    color: var(--green);
}

.count-badge.purple {
    border-color: var(--primary-border);
    background: var(--primary-soft);
    color: #b7afff;
}

.inline-add-form {
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
}

.member-search-field {
    position: relative;
    margin-bottom: 0.7rem;
}

.member-search-field svg {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 0.75rem;
    width: 16px;
    height: 16px;
    color: var(--dim);
    transform: translateY(-50%);
    pointer-events: none;
}

.member-search-field input {
    width: 100%;
    min-height: 40px;
    padding: 0.58rem 0.72rem 0.58rem 2.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: 0;
    background: var(--input);
    color: var(--text);
    font-size: 0.72rem;
}

.member-search-field input:focus {
    border-color: var(--primary-border);
    box-shadow: 0 0 0 4px rgba(124, 109, 242, 0.07);
}

.compact-member-search {
    margin-bottom: 0.55rem;
}

.member-list {
    min-height: 138px;
    margin-bottom: 0.8rem;
    display: grid;
    align-content: start;
    gap: 0.45rem;
}

.member-row {
    min-height: 58px;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.018);
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.member-avatar-image {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    object-fit: cover;
    flex: 0 0 auto;
    background: var(--surface-2);
}

.member-avatar-image.owner {
    border-color: rgba(53, 201, 139, 0.32);
}

.member-avatar-image.whitelist,
.member-avatar-image.independent {
    border-color: var(--primary-border);
}

.member-row.compact {
    min-height: 54px;
    padding: 0.55rem;
}

.member-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    flex: 0 0 auto;
}

.member-avatar.owner {
    background: var(--green-soft);
    color: var(--green);
}

.member-avatar.whitelist {
    background: var(--primary-soft);
    color: #aea5ff;
}

.member-avatar svg {
    width: 17px;
}

.member-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.member-copy strong {
    font-size: 0.7rem;
}

.member-copy > span {
    margin-top: 0.05rem;
    color: var(--muted);
    font-size: 0.62rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
}

.member-copy code {
    width: fit-content;
    max-width: 100%;
    margin-top: 0.18rem;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.61rem;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.icon-btn svg {
    width: 16px;
}

.icon-btn.danger:hover {
    border-color: rgba(239, 101, 116, 0.28);
    background: var(--red-soft);
    color: var(--red);
}

.list-empty {
    min-height: 118px;
    padding: 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.list-empty strong {
    font-size: 0.76rem;
}

.list-empty span {
    max-width: 330px;
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.66rem;
}

/* Per-module independent users */
.independent-section {
    margin-top: 1rem;
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(124, 109, 242, 0.035);
}

.independent-heading {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.independent-heading h3 {
    margin-top: 0.1rem;
    font-size: 0.86rem;
}

.independent-list {
    min-height: 82px;
    max-height: 260px;
    margin-bottom: 0;
    overflow-y: auto;
}

.hierarchy-note.neutral {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.025);
}

.hierarchy-note.neutral svg {
    color: var(--primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    padding: 1.25rem;
    background: rgba(4, 6, 10, 0.76);
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 160ms ease;
}

.modal-overlay:not([hidden]) {
    display: flex;
}

.modal-overlay.open {
    opacity: 1;
}

.modal-card {
    width: min(680px, 100%);
    max-height: calc(100vh - 2.5rem);
    padding: 1.15rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    background: #151a24;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    transform: translateY(8px) scale(0.99);
    transition: transform 160ms ease;
}

.modal-overlay.open .modal-card {
    transform: translateY(0) scale(1);
}

.modal-header {
    margin-bottom: 1rem;
    padding: 0.15rem 0.15rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.modal-heading-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-heading-group > div > span {
    color: var(--muted);
    font-size: 0.62rem;
}

.modal-heading-group h2 {
    font-size: 1rem;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.modal-toggle-row {
    margin-bottom: 1rem;
}

.modal-actions {
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

/* Custom Confirmation Modal */
.confirm-modal-card {
    width: min(520px, 100%);
}

.confirm-modal-text {
    color: var(--text-soft);
    font-size: 0.92rem;
    line-height: 1.6;
    margin: 0.5rem 0 0.5rem;
}

.module-icon.danger {
    background: rgba(239, 101, 116, 0.12);
    color: #ef6574;
    border-color: rgba(239, 101, 116, 0.28);
}

.btn-danger {
    border-color: rgba(239, 101, 116, 0.35);
    background: #ef6574;
    color: #ffffff;
}

.btn-danger:hover {
    background: #d94e5e;
    border-color: #d94e5e;
}

/* Toast */
.toast {
    position: fixed;
    z-index: 1400;
    right: 1.3rem;
    bottom: 1.3rem;
    max-width: min(390px, calc(100% - 2rem));
    padding: 0.78rem 0.9rem;
    border: 1px solid rgba(53, 201, 139, 0.25);
    border-radius: var(--radius-sm);
    background: #16251f;
    color: #b9f4d7;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    border-color: rgba(239, 101, 116, 0.28);
    background: #2a171b;
    color: #ffc1c8;
}

.toast.info {
    border-color: rgba(124, 109, 242, 0.3);
    background: #1d1a34;
    color: #d2ceff;
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

/* Responsive */
@media (max-width: 1180px) {
    .picker-grid,
    .modules-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.85rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .topbar {
        padding: 0 1rem;
        min-height: 64px;
    }

    .account-copy,
    .selected-context,
    .dashboard-topbar .btn-ghost {
        display: none;
    }

    .login-shell {
        grid-template-columns: 1fr;
        padding: 2.5rem 0;
    }

    .login-copy {
        text-align: center;
    }

    .login-copy > p {
        margin-left: auto;
        margin-right: auto;
    }

    .login-features {
        max-width: 620px;
        margin-left: auto;
        margin-right: auto;
        text-align: left;
    }

    .login-card-wrap {
        width: min(100%, 560px);
        margin: 0 auto;
    }

    .dashboard-shell {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dashboard-sidebar {
        position: static;
        height: auto;
        overflow: visible;
        padding: 0;
    }

    .sidebar-context-card,
    .sidebar-label,
    .sidebar-security-note {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        gap: 0.4rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        padding: 0.35rem 0.4rem;
        margin: 0.25rem 0 1.1rem 0;
        background: rgba(18, 22, 31, 0.95);
        border: 1px solid var(--border);
        border-radius: 14px;
        backdrop-filter: blur(12px);
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
    }

    .sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar-btn {
        width: auto;
        min-width: max-content;
        scroll-snap-align: start;
        flex-shrink: 0;
        min-height: 38px;
        padding: 0.48rem 0.85rem;
        border-radius: 10px;
        background: transparent;
        border: 1px solid transparent;
        color: var(--text-soft);
        font-size: 0.8rem;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        transition: background var(--transition), color var(--transition), border-color var(--transition);
    }

    .sidebar-btn svg {
        width: 16px;
        height: 16px;
        color: var(--muted);
    }

    .sidebar-btn.active {
        background: linear-gradient(135deg, rgba(124, 109, 242, 0.22), rgba(105, 89, 232, 0.12));
        border-color: rgba(124, 109, 242, 0.45);
        color: #ffffff;
        font-weight: 750;
        box-shadow: 0 2px 10px rgba(124, 109, 242, 0.18);
    }

    .sidebar-btn.active svg {
        color: #a5b4fc;
    }

    .sidebar-btn > span:nth-child(2) {
        flex: initial;
    }

    .access-grid {
        grid-template-columns: 1fr;
    }

    .module-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0;
        margin-bottom: 1rem;
    }

    .filter-chips {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.3rem;
        gap: 0.45rem;
        scrollbar-width: none;
    }

    .filter-chips::-webkit-scrollbar {
        display: none;
    }

    .filter-chip {
        flex-shrink: 0;
        min-height: 36px;
        padding: 0.45rem 0.85rem;
        font-size: 0.76rem;
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .modules-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .module-card {
        min-height: auto;
        padding: 1.15rem 1rem;
    }

    .module-card-copy p {
        min-height: auto;
        margin-top: 0.5rem;
        font-size: 0.78rem;
        line-height: 1.5;
    }

    .module-meta {
        margin: 0.8rem 0;
        padding: 0.6rem 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .module-meta strong {
        font-size: 0.7rem;
    }

    .module-card > .btn {
        width: 100%;
        min-height: 44px;
        font-size: 0.88rem;
        font-weight: 700;
        margin-top: 0.85rem;
    }
}

@media (max-width: 680px) {
    .topbar {
        min-height: 64px;
        padding: 0 0.85rem;
    }

    .brand-badge,
    .topbar-note,
    .dashboard-topbar .btn-ghost,
    .picker-page .account-menu .btn-ghost {
        display: none;
    }

    .topbar-actions {
        gap: 0.5rem;
    }

    .dashboard-topbar .btn-secondary {
        min-height: 38px;
        padding: 0.48rem 0.82rem;
        font-size: 0.78rem;
        font-weight: 650;
        border-radius: 10px;
    }

    .dashboard-topbar .btn-secondary svg {
        width: 15px;
        height: 15px;
    }

    .page-shell,
    .login-shell,
    .dashboard-shell {
        width: min(100% - 1rem, 1540px);
    }

    .picker-shell {
        padding-top: 1.5rem;
    }

    .picker-hero {
        margin-bottom: 1.4rem;
    }

    .steps {
        transform: scale(0.88);
        transform-origin: center;
    }

    .step-line {
        width: 36px;
    }

    .picker-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.65rem;
    }

    .search-field,
    .search-field.compact {
        width: 100%;
    }

    .search-field input {
        min-height: 44px;
        font-size: 0.88rem;
    }

    .picker-grid,
    .form-grid.two-cols {
        grid-template-columns: 1fr;
    }

    .content-header {
        min-height: 0;
        align-items: flex-start;
        flex-direction: column;
        gap: 0.85rem;
        margin-bottom: 1.25rem;
    }

    .content-header h1 {
        font-size: 1.4rem;
    }

    .content-header .btn,
    .header-status {
        width: 100%;
        min-height: 44px;
    }

    .form-actions {
        flex-direction: row;
        align-items: center;
        gap: 0.6rem;
        margin-top: 1.2rem;
    }

    .form-actions .btn {
        flex: 1;
        width: auto;
        min-height: 44px;
    }

    .setting-toggle-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
    }

    .setting-toggle-row .switch {
        align-self: flex-end;
        margin-top: -2.4rem;
    }

    .inline-add-form,
    .prefix-add-row {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .inline-add-form .btn,
    .prefix-add-row .btn {
        width: 100%;
        min-height: 44px;
    }

    .member-actions {
        gap: 0.4rem;
        align-self: flex-end;
    }

    .member-row {
        align-items: flex-start;
        padding: 0.85rem;
        border-radius: var(--radius-sm);
    }

    .member-copy {
        min-width: 0;
    }

    .member-copy strong {
        font-size: 0.84rem;
    }

    .modal-overlay {
        padding: 0;
        align-items: flex-end;
        justify-content: center;
        background: rgba(0, 0, 0, 0.78);
        backdrop-filter: blur(10px);
    }

    .modal-card {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        border-radius: 24px 24px 0 0;
        padding: 1.25rem 1.1rem 1rem;
        margin: 0;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-right: 0.2rem;
        flex: 1;
    }

    .modal-actions {
        position: sticky;
        bottom: 0;
        background: #171c26;
        padding: 0.85rem 0 0.25rem;
        margin-top: 0.85rem;
        border-top: 1px solid var(--border);
        display: flex;
        gap: 0.65rem;
        z-index: 20;
    }

    .modal-actions .btn {
        flex: 1;
        min-height: 44px;
        font-size: 0.88rem;
    }

    .toast {
        left: 0.6rem;
        right: 0.6rem;
        bottom: 0.6rem;
        max-width: none;
        text-align: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        min-height: auto;
        padding: 0.95rem;
    }

    .stat-copy strong {
        font-size: 1.35rem;
    }

    .modal-card {
        max-height: 94vh;
        padding: 1.1rem 0.9rem 0.85rem;
    }

    .multi-select-option {
        min-height: 58px;
        padding: 0.7rem 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Site Language Switcher Dropdown */
.site-lang-switcher {
    position: relative;
    display: inline-block;
}

.site-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.site-lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.site-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 140px;
    background: rgba(16, 20, 30, 0.95);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    padding: 0.35rem;
    display: none;
    flex-direction: column;
    gap: 0.2rem;
    z-index: 1000;
}

.site-lang-menu.open {
    display: flex;
    animation: fadeIn 0.15s ease-out;
}

.site-lang-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: var(--transition);
}

.site-lang-option:hover {
    background: rgba(124, 109, 242, 0.15);
    color: var(--text);
}

.site-lang-option.active {
    background: rgba(124, 109, 242, 0.22);
    color: #a5b4fc;
    font-weight: 700;
}


/* Dashboard mobile comfort pass */
.sidebar-label-mobile {
    display: none;
}

@media (max-width: 920px) {
    .dashboard-page {
        background:
            radial-gradient(circle at 12% -5%, rgba(124, 109, 242, 0.13), transparent 30%),
            var(--bg);
    }

    .dashboard-shell {
        width: min(100% - 1.25rem, 1540px);
        padding-top: 0.85rem;
        gap: 0.85rem;
    }

    .dashboard-sidebar {
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .sidebar-context-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.85rem;
        padding: 0.72rem 0.8rem;
        border-radius: 15px;
        background: linear-gradient(145deg, rgba(24, 29, 40, 0.96), rgba(17, 21, 29, 0.96));
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    }

    .context-divider {
        display: none;
    }

    .context-copy strong {
        max-width: min(48vw, 300px);
    }

    .bot-context-line {
        padding-left: 0.85rem;
        border-left: 1px solid var(--border);
    }

    .sidebar-label,
    .sidebar-security-note {
        display: none;
    }

    .dashboard-main,
    .tab-pane,
    .panel-card,
    .modules-panel,
    .settings-card {
        min-width: 0;
        max-width: 100%;
    }

    .content-header {
        min-height: 0;
        margin-bottom: 0.8rem;
        padding: 0.35rem 0.15rem 0.55rem;
    }

    .panel-card {
        padding: 1rem;
        border-radius: 18px;
    }

    .modules-panel {
        padding: 0.8rem;
    }

    .protection-row,
    .member-row,
    .filter-chip,
    .sidebar-btn,
    .btn,
    .icon-btn,
    .custom-dropdown-btn,
    .custom-dropdown-item,
    .multi-select-option {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .module-card:hover,
    .btn:hover:not(:disabled),
    .prefix-chip:hover {
        transform: none;
    }
}

@media (min-width: 681px) and (max-width: 920px) {
    .dashboard-sidebar {
        position: sticky;
        top: 72px;
        z-index: 85;
    }

    .sidebar-nav {
        position: sticky;
        top: 72px;
        margin-bottom: 0;
    }
}

@media (max-width: 680px) {
    body.dashboard-page {
        padding-bottom: calc(78px + env(safe-area-inset-bottom));
    }

    .dashboard-topbar {
        min-height: 60px;
        padding: 0 0.65rem;
        gap: 0.55rem;
    }

    .dashboard-topbar .brand {
        gap: 0.5rem;
        font-size: 1rem;
    }

    .dashboard-topbar .brand-mark {
        width: 32px;
        height: 32px;
        border-radius: 10px;
    }

    .dashboard-topbar .brand-mark svg {
        width: 18px;
        height: 18px;
    }

    .dashboard-topbar .topbar-actions {
        gap: 0.38rem;
    }

    .dashboard-topbar .site-lang-btn {
        min-height: 36px;
        padding: 0.4rem 0.58rem;
        gap: 0.32rem;
        font-size: 0.76rem;
    }

    .dashboard-topbar .btn-secondary {
        width: 36px;
        min-width: 36px;
        height: 36px;
        min-height: 36px;
        padding: 0;
        border-radius: 10px;
    }

    .dashboard-topbar .btn-secondary span {
        display: none;
    }

    .dashboard-topbar .btn-secondary svg {
        width: 17px;
        height: 17px;
    }

    .dashboard-topbar .user-avatar {
        width: 34px;
        height: 34px;
    }

    .dashboard-shell {
        width: min(100% - 0.9rem, 1540px);
        padding: 0.65rem 0 1rem;
        gap: 0.7rem;
    }

    .dashboard-sidebar {
        position: static;
    }

    .sidebar-context-card {
        grid-template-columns: minmax(0, 1fr);
        padding: 0.68rem 0.72rem;
    }

    .context-guild-avatar {
        width: 38px;
        height: 38px;
        border-radius: 11px;
    }

    .context-copy span {
        font-size: 0.6rem;
    }

    .context-copy strong {
        max-width: calc(100vw - 6.5rem);
        font-size: 0.79rem;
    }

    .bot-context-line {
        display: none;
    }

    .sidebar-nav {
        position: fixed;
        z-index: 950;
        left: 0.5rem;
        right: 0.5rem;
        bottom: max(0.5rem, env(safe-area-inset-bottom));
        width: auto;
        margin: 0;
        padding: 0.4rem;
        border-radius: 18px;
        gap: 0.25rem;
        overflow: visible;
        background: rgba(17, 21, 29, 0.96);
        box-shadow: 0 12px 38px rgba(0, 0, 0, 0.48);
        backdrop-filter: blur(22px);
    }

    .sidebar-btn {
        width: auto;
        min-width: 0;
        min-height: 52px;
        padding: 0.45rem 0.55rem;
        border-radius: 13px;
        flex: 1 1 0;
        justify-content: center;
        gap: 0.42rem;
    }

    .sidebar-btn svg {
        width: 20px;
        height: 20px;
        min-width: 20px;
    }

    .sidebar-btn .sidebar-label-desktop,
    .sidebar-btn .sidebar-label-mobile {
        display: none;
    }

    .sidebar-btn.active {
        flex-grow: 1.75;
        padding-inline: 0.68rem;
    }

    .sidebar-btn.active .sidebar-label-mobile {
        display: block;
        min-width: 0;
        overflow: hidden;
        font-size: 0.67rem;
        font-weight: 800;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar-btn .nav-count,
    .sidebar-btn .nav-dot {
        display: none;
    }

    body.modal-open .sidebar-nav {
        pointer-events: none;
        opacity: 0;
        transform: translateY(120%);
    }

    .content-header {
        gap: 0.7rem;
        margin-bottom: 0.75rem;
        padding: 0.15rem 0.15rem 0.45rem;
    }

    .content-header h1 {
        margin-top: 0.25rem;
        font-size: clamp(1.3rem, 7vw, 1.65rem);
        line-height: 1.16;
    }

    .content-header p {
        margin-top: 0.35rem;
        font-size: 0.76rem;
        line-height: 1.5;
    }

    .content-header .btn,
    .header-status {
        min-height: 42px;
    }

    .panel-card {
        padding: 0.9rem;
        border-radius: 17px;
    }

    .panel-heading {
        margin-bottom: 0.8rem;
    }

    .panel-heading h2 {
        font-size: 0.96rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.58rem;
        margin-bottom: 0.75rem;
    }

    .stat-card {
        min-height: 116px;
        padding: 0.78rem;
        border-radius: 15px;
    }

    .stat-icon {
        width: 30px;
        height: 30px;
        border-radius: 9px;
    }

    .stat-icon svg {
        width: 16px;
        height: 16px;
    }

    .stat-copy {
        margin-top: 0.65rem;
        align-items: flex-start;
        flex-direction: column;
        gap: 0.3rem;
    }

    .stat-copy span {
        font-size: 0.62rem;
        line-height: 1.3;
    }

    .stat-copy strong {
        font-size: 1.28rem;
    }

    .stat-copy .status-text {
        font-size: 0.82rem;
    }

    .stat-progress {
        margin-top: 0.65rem;
    }

    .stat-foot {
        margin-top: 0.55rem;
        font-size: 0.57rem;
        line-height: 1.25;
    }

    .overview-grid {
        gap: 0.75rem;
    }

    .protection-row {
        padding: 0.62rem;
        gap: 0.58rem;
    }

    .mini-module-icon {
        width: 32px;
        height: 32px;
        border-radius: 9px;
        flex: 0 0 auto;
    }

    .protection-name strong {
        font-size: 0.73rem;
    }

    .protection-name small {
        font-size: 0.59rem;
    }

    .protection-row .status-badge {
        padding: 0.3rem 0.48rem;
        font-size: 0.58rem;
    }

    .context-details > div {
        min-height: 44px;
        padding: 0.62rem 0;
        gap: 0.65rem;
    }

    .context-details dd {
        max-width: 68%;
        min-width: 0;
        font-size: 0.7rem;
    }

    .context-details dd code {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        word-break: normal;
    }

    .module-toolbar {
        margin-bottom: 0.75rem;
        gap: 0.6rem;
    }

    .search-field.compact,
    .member-search-field input,
    .form-input,
    .custom-dropdown-btn {
        min-height: 44px;
        font-size: 0.82rem;
    }

    .filter-chips {
        margin-inline: -0.15rem;
        padding: 0 0.15rem 0.25rem;
    }

    .filter-chip {
        min-height: 34px;
        padding: 0.4rem 0.72rem;
        font-size: 0.69rem;
    }

    .modules-grid {
        gap: 0.65rem;
    }

    .module-card {
        padding: 0.9rem;
        border-radius: 15px;
    }

    .module-card-copy {
        margin-top: 0.72rem;
    }

    .module-card-copy p {
        margin-top: 0.42rem;
        font-size: 0.72rem;
    }

    .module-meta {
        margin: 0.7rem 0;
        padding: 0.55rem 0;
    }

    .module-card > .btn {
        min-height: 42px;
        margin-top: 0.65rem;
    }

    .setting-toggle-row {
        padding: 0.85rem;
    }

    .setting-leading {
        align-items: flex-start;
        gap: 0.65rem;
        padding-right: 3.2rem;
    }

    .setting-icon {
        width: 38px;
        height: 38px;
        flex: 0 0 auto;
    }

    .form-actions {
        position: sticky;
        bottom: calc(70px + env(safe-area-inset-bottom));
        z-index: 40;
        margin: 1rem -0.3rem -0.3rem;
        padding: 0.72rem 0.3rem 0.3rem;
        background: linear-gradient(to bottom, rgba(21, 26, 36, 0), #151a24 28%);
    }

    .form-security-hint {
        display: none;
    }

    .access-warning {
        padding: 0.78rem;
        gap: 0.6rem;
    }

    .access-card .panel-heading {
        align-items: flex-start;
    }

    .member-row {
        gap: 0.55rem;
    }

    .member-copy code {
        max-width: calc(100vw - 10.5rem);
    }

    .independent-section {
        padding: 0.75rem;
    }

    .prefix-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.35rem;
    }

    .modal-overlay {
        z-index: 1200;
    }

    .modal-card {
        max-height: calc(94dvh - env(safe-area-inset-top));
        padding-bottom: calc(0.85rem + env(safe-area-inset-bottom));
    }

    .modal-header {
        position: sticky;
        z-index: 15;
        top: -1.25rem;
        margin-inline: -0.1rem;
        padding-top: 1.2rem;
        background: #151a24;
    }

    .modal-heading-group {
        min-width: 0;
    }

    .modal-heading-group > div {
        min-width: 0;
    }

    .modal-heading-group h2 {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .modal-actions {
        padding-bottom: max(0.25rem, env(safe-area-inset-bottom));
    }

    .toast {
        bottom: calc(76px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 410px) {
    .dashboard-topbar #site-lang-code,
    .dashboard-topbar .site-lang-btn svg {
        display: none;
    }

    .dashboard-topbar .site-lang-btn {
        width: 36px;
        min-width: 36px;
        justify-content: center;
        padding: 0;
    }

    .sidebar-btn.active {
        flex-grow: 1.55;
    }

    .sidebar-btn.active .sidebar-label-mobile {
        font-size: 0.63rem;
    }

    .stat-foot {
        display: none;
    }
}

@media (max-width: 350px) {
    .dashboard-topbar .brand > span:nth-child(2) {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-height: 105px;
    }

    .sidebar-btn.active .sidebar-label-mobile {
        display: none;
    }
}
