* { box-sizing: border-box; }

:root {
    --bg: #09090d;
    --surface: #111116;
    --surface-2: #17171e;
    --surface-3: #1d1d26;
    --border: #262630;
    --text: #f4f4f6;
    --muted: #90909d;
    --accent: #8957ff;
    --accent-soft: rgba(137, 87, 255, .14);
    --green: #4fd18b;
    --red: #ff6868;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 245px 1fr;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 245px;
    padding: 22px 16px;
    background: #0d0d12;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 28px;
}

.sidebar-logo, .brand-mark {
    display: grid;
    place-items: center;
    background: var(--accent);
    font-weight: 800;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
}

.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand small { color: var(--muted); margin-top: 2px; }

.nav-label {
    margin: 24px 10px 8px;
    color: #60606c;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.nav-item {
    display: block;
    padding: 11px 12px;
    margin: 2px 0;
    border-radius: 8px;
    color: #a5a5b0;
}

.nav-item:hover, .nav-item.active {
    color: white;
    background: var(--surface-2);
}

.nav-item.active { box-shadow: inset 3px 0 0 var(--accent); }

.logout {
    margin-top: auto;
    color: var(--muted);
    padding: 12px;
}

.content {
    grid-column: 2;
    padding: 24px 42px 60px;
}

.global-topbar {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-form, .user-box {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.language-form {
    height: 40px;
    gap: 7px;
    padding: 0 9px;
}

.language-icon { font-size: 14px; }

.language-select {
    padding: 0 22px 0 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    outline: none;
}

.user-box {
    gap: 9px;
    padding: 8px 11px;
}

.user-box strong, .user-box small { display: block; }
.user-box small { color: var(--accent); margin-top: 2px; }

.topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.page-heading { margin-bottom: 24px; }
.page-heading h1 { margin: 0; font-size: 25px; }
.page-heading p { margin: 6px 0 0; color: var(--muted); }

.welcome {
    padding: 28px;
    border: 1px solid rgba(137,87,255,.25);
    background: linear-gradient(120deg, rgba(137,87,255,.13), transparent 55%), var(--surface);
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

.welcome h2 { margin: 7px 0; font-size: 27px; }
.welcome p { margin: 0; color: var(--muted); }

.eyebrow {
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
}

.version {
    height: fit-content;
    padding: 6px 10px;
    background: var(--accent-soft);
    color: #b79cff;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 34px;
}

.mini-stat, .bot-card, .panel-card, .settings-card, .access-setting-card {
    background: var(--surface);
    border: 1px solid var(--border);
}

.mini-stat {
    border-radius: 12px;
    padding: 18px;
}

.mini-stat span { color: var(--muted); font-size: 12px; }
.mini-stat strong { display: block; font-size: 24px; margin-top: 6px; }

.section-header { margin-bottom: 18px; }
.section-header h2 { margin: 0; font-size: 19px; }
.section-header p { margin: 5px 0 0; color: var(--muted); }

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

.bot-card {
    padding: 20px;
    border-radius: 14px;
}

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

.bot-icon, .avatar-placeholder {
    display: grid;
    place-items: center;
    background: var(--surface-3);
    font-weight: 800;
}

.bot-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.bot-card h3 { margin: 20px 0 4px; }
.bot-card > p { margin: 0; color: var(--muted); font-size: 13px; }

.status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
}

.status span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

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

.card-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 22px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
}

.card-footer strong { color: var(--text); }

input, select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 11px;
    outline: none;
}

input:focus, select:focus { border-color: var(--accent); }

.button {
    border: 0;
    color: white;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
}

.button.primary {
    background: var(--accent);
    padding: 11px 16px;
}

.button.subtle {
    padding: 8px 11px;
    background: var(--surface-3);
    border: 1px solid var(--border);
}

.access-tabs, .role-editor-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 11px;
}

.access-tab, .role-editor-tab {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 9px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

.access-tab span {
    margin-left: 6px;
    padding: 2px 6px;
    background: var(--surface-3);
    border-radius: 5px;
    font-size: 10px;
}

.access-tab.active, .role-editor-tab.active {
    color: white;
    background: var(--surface-3);
}

.access-tab-content, .role-tab-panel { display: none; }
.access-tab-content.active, .role-tab-panel.active { display: block; }

.panel-card {
    border-radius: 14px;
    padding: 20px;
}

.clean-card {
    padding: 0;
    overflow: hidden;
}

.compact-add-form, .compact-role-form {
    display: grid;
    grid-template-columns: 1fr .7fr auto;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.compact-role-form { grid-template-columns: 1fr 120px auto; }

.access-table-head, .access-table-row {
    display: grid;
    grid-template-columns: 1.3fr 1fr 130px 165px 90px;
    gap: 16px;
    align-items: center;
}

.access-table-head {
    padding: 11px 16px;
    color: #686875;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.access-table-row {
    padding: 13px 16px;
    border-top: 1px solid var(--border);
}

.person-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.person-cell strong, .person-cell small { display: block; }
.person-cell small { color: var(--muted); font-size: 10px; margin-top: 3px; }

.avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 9px;
}

.role-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.role-chip, .empty-chip, .system-badge, .state-pill {
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 7px;
}

.role-chip { color: #baa4ff; background: var(--accent-soft); }
.empty-chip, .system-badge { color: var(--muted); background: var(--surface-3); }
.state-pill.active { color: var(--green); background: rgba(79,209,139,.10); }
.state-pill.inactive { color: var(--red); background: rgba(255,104,104,.10); }

.muted { color: var(--muted); }

.user-detail-panel {
    display: none;
    padding: 18px;
    background: #0e0e14;
    border-top: 1px solid var(--border);
}

.user-detail-panel.open { display: block; }

.effective-title {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

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

.effective-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
}

.access-level { font-size: 11px; font-weight: 800; }
.access-level.full { color: var(--green); }
.access-level.view { color: #baa4ff; }
.access-level.none { color: var(--muted); }

.user-management-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.role-assignment-form { display: flex; gap: 7px; }
.assigned-role-actions { display: flex; flex-wrap: wrap; gap: 5px; }

.role-remove-button {
    border: 1px solid var(--border);
    background: var(--surface-3);
    color: #aaaab7;
    border-radius: 7px;
    padding: 8px 9px;
    cursor: pointer;
}

.role-remove-button:hover {
    color: var(--red);
    border-color: rgba(255,104,104,.35);
}

.account-toggle-form { margin-left: auto; }

.danger-button, .success-button {
    padding: 9px 12px;
    background: transparent;
}

.danger-button {
    border: 1px solid rgba(255,104,104,.25);
    color: var(--red);
}

.success-button {
    border: 1px solid rgba(79,209,139,.25);
    color: var(--green);
}

.role-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 16px;
}

.role-overview-card {
    padding: 17px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 11px;
    transition: .15s ease;
}

.role-overview-card:hover {
    transform: translateY(-1px);
    border-color: #494957;
}

.role-overview-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.role-overview-top h3 { margin: 0 0 4px; }
.role-overview-top div > span { color: var(--muted); font-size: 11px; }

.role-access-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 18px;
}

.role-access-summary div {
    padding: 9px;
    background: var(--surface);
    border-radius: 7px;
}

.role-access-summary span, .role-access-summary strong { display: block; }
.role-access-summary span { color: var(--muted); font-size: 10px; }
.role-access-summary strong { margin-top: 4px; font-size: 12px; }

.role-heading-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.back-link {
    display: inline-block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 10px;
}

.settings-card, .access-setting-card { border-radius: 13px; }
.settings-card { overflow: hidden; }

.settings-card-header, .access-master-row { padding: 19px; }

.settings-card-header h2, .access-master-row h2 {
    margin: 0;
    font-size: 17px;
}

.settings-card-header p, .access-master-row p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.access-master-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.role-general-grid {
    display: grid;
    grid-template-columns: 1fr 160px 220px;
    gap: 13px;
    padding: 0 19px 19px;
}

.field span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.field input, .field select { width: 100%; }

.access-setting-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    padding: 17px 19px;
    margin-top: 10px;
}

.access-setting-info h3 { margin: 0; font-size: 14px; }
.access-setting-info p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }

.segmented-control {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 110px);
    gap: 3px;
    padding: 3px;
    background: #0b0b10;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.segmented-control.two { grid-template-columns: repeat(2, 110px); }
.segmented-control label { cursor: pointer; }
.segmented-control input { display: none; }

.segmented-control span {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--muted);
    text-align: center;
    font-size: 11px;
    font-weight: 700;
}

.segmented-control input:checked + span {
    color: white;
    background: var(--accent);
}

.switch {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.switch input { display: none; }

.switch span {
    width: 38px;
    height: 21px;
    border-radius: 30px;
    background: #292933;
    position: relative;
    cursor: pointer;
    transition: .15s ease;
}

.switch span::after {
    content: "";
    position: absolute;
    width: 15px;
    height: 15px;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: #8b8b98;
    transition: .15s ease;
}

.switch input:checked + span { background: var(--accent); }

.switch input:checked + span::after {
    transform: translateX(17px);
    background: white;
}

.simple-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 16px 19px;
    border-top: 1px solid var(--border);
}

.simple-toggle-row h3 { margin: 0; font-size: 13px; }
.simple-toggle-row p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }

.save-bar {
    position: sticky;
    bottom: 18px;
    z-index: 20;
    margin-top: 20px;
    padding: 14px 16px;
    background: rgba(17,17,22,.96);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 18px 50px rgba(0,0,0,.3);
}

.save-bar strong, .save-bar span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.save-button { min-width: 150px; }

.notice-card {
    padding: 20px;
    border-radius: 12px;
    background: var(--accent-soft);
    border: 1px solid rgba(137,87,255,.28);
}

.notice-card p { color: var(--muted); margin-bottom: 0; }

.audit-table { overflow-x: auto; }

.audit-head, .audit-row {
    min-width: 1000px;
    display: grid;
    grid-template-columns: 160px 180px 190px 180px 1fr;
    gap: 14px;
    align-items: center;
}

.audit-head {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: .08em;
    padding: 12px 16px;
}

.audit-row {
    border-top: 1px solid var(--border);
    padding: 13px 16px;
    font-size: 12px;
}

.audit-row code { color: #baa4ff; }
.details-text {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 50% 20%, rgba(137,87,255,.14), transparent 35%), var(--bg);
}

.login-card {
    width: min(420px, calc(100% - 32px));
    padding: 42px;
    background: rgba(17,17,22,.92);
    border: 1px solid var(--border);
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0,0,0,.35);
}

.brand-mark {
    width: 58px;
    height: 58px;
    margin: 0 auto 20px;
    border-radius: 15px;
    font-size: 21px;
}

.login-card h1 { margin: 0 0 10px; }
.login-card p { margin: 0 0 28px; color: var(--muted); line-height: 1.6; }

.discord-button, .secondary-button {
    display: block;
    width: 100%;
    padding: 14px 18px;
    border-radius: 10px;
    font-weight: 700;
}

.discord-button { background: #5865f2; }
.secondary-button { background: var(--surface-3); }
.login-footer { margin-top: 22px; color: #666673; font-size: 12px; }

@media (max-width: 1200px) {
    .access-table-head { display: none; }

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

    .access-table-row > :nth-child(2),
    .access-table-row > :nth-child(3),
    .access-table-row > :nth-child(4) {
        grid-column: 1;
    }

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

@media (max-width: 900px) {
    .layout { display: block; }
    .sidebar { display: none; }
    .content { padding: 20px 18px 50px; }
    .global-topbar { justify-content: flex-end; }
    .bot-grid, .stat-grid, .effective-grid { grid-template-columns: 1fr; }

    .access-setting-card {
        align-items: stretch;
        flex-direction: column;
    }

    .segmented-control {
        grid-template-columns: repeat(3, 1fr);
        width: 100%;
    }

    .segmented-control.two {
        grid-template-columns: repeat(2, 1fr);
    }

    .compact-add-form, .compact-role-form { grid-template-columns: 1fr; }
}


/* =========================================================
   PCC V0.4 - DISCORD ROLE SYNC + COMBINED BOT PERMISSIONS
========================================================= */

.discord-sync-card,
.role-workbench-card,
.selected-discord-role-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
}

.discord-sync-main,
.selected-discord-role-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.discord-sync-main strong,
.discord-sync-main small {
    display: block;
}

.discord-sync-main small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.connection-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.connection-dot.online {
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(79,209,139,.08);
}

.connection-dot.warning {
    background: #f0b35b;
    box-shadow: 0 0 0 5px rgba(240,179,91,.08);
}

.discord-error-banner {
    display: flex;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 12px;
    border: 1px solid rgba(255,104,104,.28);
    background: rgba(255,104,104,.07);
    color: #ffaaaa;
    border-radius: 10px;
    font-size: 11px;
}

.role-workbench-card {
    align-items: flex-end;
}

.role-picker-column {
    width: min(680px, 100%);
}

.control-label {
    display: block;
    margin: 0 0 7px 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.custom-role-picker {
    position: relative;
}

.custom-role-picker-button {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
    text-align: left;
}

.custom-role-picker-button:hover {
    border-color: #454554;
}

.discord-role-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-radius: 50%;
}

.selected-role-name {
    font-weight: 750;
}

.base-role-badge {
    padding: 3px 6px;
    color: var(--muted);
    background: var(--surface-3);
    border-radius: 5px;
    font-size: 9px;
    font-weight: 800;
}

.picker-chevron {
    margin-left: auto;
    color: var(--muted);
}

.custom-role-menu {
    display: none;
    position: absolute;
    z-index: 100;
    top: calc(100% + 7px);
    left: 0;
    width: 100%;
    max-height: 430px;
    padding: 8px;
    overflow: hidden;
    background: #121218;
    border: 1px solid var(--border);
    border-radius: 11px;
    box-shadow: 0 24px 70px rgba(0,0,0,.45);
}

.custom-role-menu.open {
    display: block;
}

.role-search-input {
    width: 100%;
    margin-bottom: 7px;
}

.role-picker-list {
    max-height: 350px;
    overflow-y: auto;
}

.discord-role-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
}

.discord-role-option:hover {
    background: var(--surface-3);
}

.discord-role-option-main {
    min-width: 0;
    flex: 1;
}

.discord-role-option-main strong,
.discord-role-option-main small {
    display: block;
}

.discord-role-option-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.discord-role-option-main small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.selected-check {
    color: var(--accent);
    font-weight: 900;
}

.managed-role-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 11px;
    color: var(--muted);
    font-size: 10px;
    cursor: pointer;
}

.managed-role-toggle input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
}

.selected-discord-role-card {
    margin-bottom: 18px;
}

.selected-discord-role-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid;
    border-radius: 11px;
    background: var(--surface-2);
}

.selected-discord-role-icon span {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.selected-discord-role-identity h2 {
    margin: 3px 0 2px;
    font-size: 18px;
}

.selected-discord-role-identity p {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
}

.role-permission-summary {
    text-align: right;
}

.role-permission-summary span,
.role-permission-summary strong {
    display: block;
}

.role-permission-summary span {
    color: var(--muted);
    font-size: 10px;
}

.role-permission-summary strong {
    margin-top: 3px;
    font-size: 22px;
}

.bot-permission-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.permission-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.permission-category-tab {
    padding: 8px 11px;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 750;
}

.permission-category-tab:hover {
    color: white;
}

.permission-category-tab.active {
    color: white;
    background: var(--surface-3);
    border-color: #454554;
}

.permission-search {
    width: min(330px, 100%);
}

.combined-permission-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.combined-permission-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.permission-card-main {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 15px 17px;
}

.permission-card-title-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.permission-card-title-line h3 {
    margin: 0;
    font-size: 14px;
}

.permission-card-copy p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 10px;
}

.bot-source-badge {
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.bot-source-badge.guard {
    color: #c8b8ff;
    background: rgba(137,87,255,.13);
}

.bot-source-badge.sentinel {
    color: #a7cfff;
    background: rgba(85,148,255,.12);
}

.permission-card-actions {
    display: flex;
    align-items: center;
    gap: 11px;
    flex: 0 0 auto;
}

.large-switch {
    display: inline-flex;
}

.large-switch input {
    display: none;
}

.large-switch span {
    position: relative;
    width: 48px;
    height: 26px;
    background: #2a2a34;
    border: 1px solid #383845;
    border-radius: 30px;
    cursor: pointer;
    transition: .15s ease;
}

.large-switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #9999a5;
    border-radius: 50%;
    transition: .15s ease;
}

.large-switch input:checked + span {
    background: var(--accent);
    border-color: #a98cff;
}

.large-switch input:checked + span::after {
    transform: translateX(22px);
    background: white;
}

.large-switch input:disabled + span {
    opacity: .45;
    cursor: not-allowed;
}

.permission-card-details {
    display: none;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 17px;
    border-top: 1px solid var(--border);
    background: #0e0e14;
}

.combined-permission-card.details-open .permission-card-details {
    display: flex;
}

.permission-card-details strong {
    font-size: 11px;
}

.permission-card-details p {
    max-width: 800px;
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}

.permission-detail-meta {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.permission-detail-meta span {
    padding: 5px 7px;
    background: var(--surface-3);
    color: var(--muted);
    border-radius: 6px;
    font-size: 9px;
}

.bot-permission-save-bar {
    margin-bottom: 0;
}

.empty-discord-state {
    padding: 50px 20px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
}

.empty-discord-state h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.empty-discord-state p {
    max-width: 650px;
    margin: 0 auto;
    color: var(--muted);
    line-height: 1.6;
}

@media (max-width: 900px) {
    .role-workbench-card,
    .selected-discord-role-card,
    .bot-permission-toolbar,
    .permission-card-main {
        align-items: stretch;
        flex-direction: column;
    }

    .managed-role-toggle {
        padding: 0;
    }

    .role-permission-summary {
        text-align: left;
    }

    .permission-search {
        width: 100%;
    }

    .permission-card-actions {
        justify-content: flex-end;
    }

    .permission-card-details {
        flex-direction: column;
    }
}


/* =========================================================
   PCC V0.5 - GROUPED PERMISSIONS
========================================================= */

.permission-role-sticky-shell {
    position: sticky;
    top: 8px;
    z-index: 40;
    margin-bottom: 14px;
}

.compact-role-workbench {
    margin-bottom: 0;
    box-shadow: 0 12px 34px rgba(0,0,0,.24);
    backdrop-filter: blur(14px);
    background: rgba(17,17,22,.94);
}

.sticky-role-summary {
    min-width: 190px;
    margin-left: auto;
}

.sticky-role-summary-main {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}

.sticky-role-summary-main strong {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sticky-role-summary-main span {
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
}

.permission-category-tab span {
    margin-left: 4px;
    color: #777785;
    font-size: 9px;
}

.permission-category-tab.active span {
    color: #cbbdff;
}

.permission-groups {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.permission-group {
    scroll-margin-top: 95px;
}

.permission-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 4px 8px;
}

.permission-group-header > div:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
}

.permission-group-kicker {
    color: #a9a9b5;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .12em;
}

.permission-group-header strong {
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
}

.group-bulk-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #5f5f6d;
    font-size: 9px;
}

.bulk-link {
    padding: 0;
    background: transparent;
    border: 0;
    color: #8f8f9c;
    cursor: pointer;
    font-size: 9px;
    font-weight: 700;
}

.bulk-link:hover {
    color: #c9baff;
}

.permission-group .combined-permission-list {
    gap: 7px;
}

.permission-group .combined-permission-card {
    border-radius: 10px;
}

.permission-group .permission-card-main {
    min-height: 70px;
    padding: 13px 15px;
}

.permission-group .permission-card-copy p {
    max-width: 850px;
}

@media (max-width: 1100px) {
    .permission-role-sticky-shell {
        position: static;
    }

    .compact-role-workbench {
        align-items: stretch;
        flex-direction: column;
    }

    .sticky-role-summary {
        margin-left: 0;
    }

    .permission-group-header {
        align-items: flex-start;
        flex-direction: column;
    }
}


/* =========================================================
   PCC V0.5.1 - CUSTOM LANGUAGE DROPDOWN
========================================================= */

.language-picker {
    position: relative;
}

.language-picker-button {
    height: 40px;
    min-width: 122px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.language-picker-button:hover {
    border-color: #454554;
    background: var(--surface-2);
}

.language-chevron {
    margin-left: auto;
    color: var(--muted);
}

.language-menu {
    display: none;
    position: absolute;
    z-index: 120;
    top: calc(100% + 7px);
    right: 0;
    width: 165px;
    padding: 6px;
    background: #121218;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 18px 50px rgba(0,0,0,.42);
}

.language-menu.open {
    display: block;
}

.language-menu form {
    margin: 0;
}

.language-option {
    width: 100%;
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    background: transparent;
    color: #b8b8c4;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
}

.language-option:hover {
    color: white;
    background: var(--surface-3);
}

.language-option.active {
    color: white;
    background: var(--accent-soft);
}

.language-check {
    color: var(--accent);
    font-weight: 900;
}
