:root {
    color-scheme: light;
    --font-sans: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
    --surface-page: #f5f6fa;
    --surface-primary: #ffffff;
    --surface-muted: #f1f5f9;
    --surface-subtle: #e2e8f0;
    --surface-sidebar: #0f172a;
    --surface-sidebar-active: rgba(59, 130, 246, 0.18);
    --surface-sidebar-hover: rgba(59, 130, 246, 0.12);
    --surface-overlay: rgba(15, 23, 42, 0.75);
    --surface-overlay-strong: rgba(15, 23, 42, 0.85);
    --border-subtle: #e2e8f0;
    --border-strong: rgba(59, 130, 246, 0.4);
    --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-overlay: 0 24px 48px rgba(15, 23, 42, 0.24);
    --text-primary: #1f2a37;
    --text-muted: #64748b;
    --text-inverse: #f8fafc;
    --accent-primary: #3b82f6;
    --accent-primary-strong: #1d4ed8;
    --accent-success: #22c55e;
    --accent-warning: #f97316;
    --accent-danger: #ef4444;
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --spacing-xs: 0.375rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1.25rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* 추가: 아바타 이미지 변수 기본값 */
    --avatar-image: none;
}

body {
    font-family: var(--font-sans);
    background: var(--surface-page);
    color: var(--text-primary);
}

p,
span,
small,
label,
input,
select,
textarea,
button {
    font-family: inherit;
}

a { color: var(--accent-primary); }
a:hover, a:focus { color: var(--accent-primary-strong); }

.app-shell {
    min-height: 100vh;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(248, 250, 252, 0.6) 100%);
}

.app-sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--surface-sidebar);
    color: var(--text-inverse);
    padding: var(--spacing-lg) var(--spacing-md);
    box-shadow: var(--shadow-soft);
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: var(--spacing-lg);
}
.app-sidebar__title { font-size: 1.25rem; font-weight: 700; }

.app-sidebar__nav { display: flex; flex-direction: column; gap: 0.5rem; }

.app-sidebar__link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem; border-radius: var(--radius-md);
    color: rgba(248, 250, 252, 0.74);
    font-weight: 500; text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}
.app-sidebar__link:hover, .app-sidebar__link:focus { background: var(--surface-sidebar-hover); color: var(--text-inverse); }
.app-sidebar__link.is-active {
    background: var(--surface-sidebar-active); color: var(--text-inverse);
    border-left: 4px solid var(--accent-primary);
    padding-left: calc(1rem - 4px + 0.25rem);
}
.app-sidebar__link.is-disabled { color: rgba(248, 250, 252, 0.35); cursor: not-allowed; opacity: 0.65; }

.app-sidebar__footer {
    margin-top: auto; padding-top: var(--spacing-lg);
    font-size: 0.85rem; color: rgba(248, 250, 252, 0.5);
}

.app-content {
    flex-grow: 1; min-height: 100vh;
    display: flex; flex-direction: column; background: transparent;
}
@media (min-width: 992px) { .app-content { margin-left: 260px; } }

.app-main { padding: 1.5rem 1.5rem 2.5rem; }
@media (min-width: 992px) { .app-main { padding: 2rem 2.5rem 3.5rem; } }

.card-elevated {
    border: none !important; background: var(--surface-primary);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-soft);
}
.card-elevated .card-header, .card-elevated .card-body { border: none; background: transparent; }

.section-heading { font-weight: 600; font-size: 2rem; }

.badge-soft { background: rgba(59,130,246,0.15) !important; color: var(--accent-primary-strong) !important; }

/* ===== Environment badge ===== */
.environment-badge {
    display: inline-flex; align-items: center; gap: .4ch;
    padding: 0.22rem 0.66rem; border-radius: 999px;
    font-size: .78rem; font-weight: 700; letter-spacing: -.01em;
    line-height: 1.15; white-space: nowrap;
    text-shadow: 0 1px 0 rgba(0,0,0,.35);
}
.environment-badge--local{--badge-start:#06b6d4;--badge-end:#3b82f6;--badge-ring:rgba(56,189,248,.55);--badge-glow:rgba(56,189,248,.32);color:#fff;background:linear-gradient(90deg,var(--badge-start)0%,var(--badge-end)100%);box-shadow:0 0 0 1px var(--badge-ring) inset,0 6px 18px var(--badge-glow);}
.environment-badge--dev  {--badge-start:#e879f9;--badge-end:#8b5cf6;--badge-ring:rgba(232,121,249,.55);--badge-glow:rgba(139,92,246,.32);color:#fff;background:linear-gradient(90deg,var(--badge-start)0%,var(--badge-end)100%);box-shadow:0 0 0 1px var(--badge-ring) inset,0 6px 18px var(--badge-glow);}
.environment-badge--prod {--badge-start:#a3e635;--badge-end:#22c55e;--badge-ring:rgba(163,230,53,.55);--badge-glow:rgba(34,197,94,.30);color:#0b1b13;background:linear-gradient(90deg,var(--badge-start)0%,var(--badge-end)100%);box-shadow:0 0 0 1px var(--badge-ring) inset,0 6px 18px var(--badge-glow);}
@media (prefers-color-scheme: light){
    .app-content .environment-badge--local,.card .environment-badge--local{box-shadow:0 0 0 1px rgba(56,189,248,.35) inset;}
    .app-content .environment-badge--dev,.card .environment-badge--dev{box-shadow:0 0 0 1px rgba(232,121,249,.35) inset;}
    .app-content .environment-badge--prod,.card .environment-badge--prod{box-shadow:0 0 0 1px rgba(163,230,53,.35) inset;}
}

.table-modern thead th {
    background: var(--surface-muted); font-size: 0.875rem; font-weight: 600;
    color: var(--text-muted); border-bottom: 1px solid var(--border-subtle);
}
.table-modern tbody tr:hover { background: rgba(59,130,246,0.06); }
.table-modern tbody td { vertical-align: middle; }
.table-responsive { border-radius: var(--radius-lg); overflow: hidden; }
.table-responsive .table { margin-bottom: 0; }
.table-shell { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-subtle); }
.table-shell .table { margin-bottom: 0; }

.btn-icon {
    width: 2.5rem; height: 2.5rem;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
}

.status-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; margin-right: 0.5rem; }
.status-active { background: var(--accent-success); }
.status-pending{ background: var(--accent-warning); }
.status-danger { background: var(--accent-danger); }
.status-muted  { background: rgba(148, 163, 184, 1); }

.form-control::placeholder { color: rgba(148,163,184,0.9); }

.breadcrumb-item + .breadcrumb-item::before {
    content: "\f285"; font-family: "Bootstrap-icons"; font-size: 0.75rem;
}

.tooltip-bubble .tooltip-inner {
    background-color: #1f2937; color: #ffffff;
    border-radius: var(--radius-md); box-shadow: var(--shadow-soft);
    padding: 0.5rem 0.75rem;
}
.tooltip-bubble .tooltip-arrow::before {
    border-width: 0.5rem 0.5rem 0; border-top-color: #1f2937;
    filter: drop-shadow(0 6px 6px rgba(15, 23, 42, 0.2));
}

.upcoming-feature { opacity: 0.55; cursor: not-allowed !important; }
.upcoming-feature:hover, .upcoming-feature:focus { opacity: 0.55; }

.tooltip-wrapper { display: block; width: 100%; cursor: not-allowed; }
.tooltip-wrapper .btn { pointer-events: none; }

.media-thumb { border-radius: var(--radius-lg); object-fit: cover; display: block; }
.media-thumb--square-lg { width: 72px; height: 72px; }

.text-truncate-md { max-width: 260px; }

.collection-image-thumbnail {
    max-height: 320px; object-fit: cover; width: 100%; border-radius: var(--radius-xl);
}
.collection-image-modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1080; }
.collection-image-modal.d-none { display: none !important; }
.collection-image-modal .collection-image-backdrop { position: absolute; inset: 0; background: var(--surface-overlay); }
.collection-image-modal .collection-image-dialog { position: relative; max-width: min(90vw, 1024px); max-height: 90vh; box-shadow: var(--shadow-overlay); }
.collection-image-modal .collection-image-dialog img { width: 100%; height: auto; max-height: 90vh; object-fit: contain; border-radius: var(--radius-xl); }
.collection-image-modal .btn-close {
    position: absolute; top: -16px; right: -16px; background-color: var(--surface-overlay-strong);
    border-radius: 999px; padding: 0.75rem; opacity: 1;
}

.collection-note-highlight {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-xl);
    padding: var(--spacing-md);
}
.note-label {
    font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--accent-primary-strong); font-weight: 600;
}
.collection-one-line-note { white-space: pre-line; font-weight: 600; font-size: 1rem; }
.collection-detail-meta dl { font-size: 0.9rem; }

.surface-muted { background: var(--surface-muted) !important; color: var(--text-primary); }
.rounded-lg { border-radius: var(--radius-lg) !important; }

.profile-avatar {
    width: 64px; height: 64px; border-radius: 50%;
    background: rgba(148, 163, 184, 0.35);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 1.5rem;
    background-image: var(--avatar-image, none);
    background-size: cover; background-position: center; background-repeat: no-repeat;
}

.table-empty-state { padding: 3rem 0; color: var(--text-muted); }

.metric-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.metric-card--interactive { cursor: pointer; }
.metric-card--interactive:hover, .metric-card--interactive:focus-visible {
    transform: translateY(-4px); box-shadow: var(--shadow-soft);
}
.metric-card--interactive:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 4px; }

.report-card { border: none; background: transparent; }
.report-card + .report-card { border-top: 1px solid var(--border-subtle); }
.report-card__link {
    display: block; padding: var(--spacing-md); border-radius: var(--radius-lg);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.report-card__link:hover, .report-card__link:focus-visible {
    background: var(--surface-muted); box-shadow: var(--shadow-soft); transform: translateY(-2px);
}
.report-card__link:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.report-card:hover .report-card__link, .report-card:focus-within .report-card__link {
    background: var(--surface-muted); box-shadow: var(--shadow-soft);
}
.report-card__footer { padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md); border-color: var(--border-subtle) !important; }

.audit-log-card { border: none; background: transparent; }
.audit-log-card + .audit-log-card { border-top: 1px solid var(--border-subtle); }
.audit-log-card__content { padding: var(--spacing-md); display: flex; flex-direction: column; gap: var(--spacing-md); }
.audit-log-details { display: block; }
.audit-log-details__summary {
    display: inline-flex; align-items: center; gap: var(--spacing-xs);
    cursor: pointer; font-weight: 600; color: var(--accent-primary); text-decoration: none;
}
.audit-log-details__summary:hover, .audit-log-details__summary:focus-visible { color: var(--accent-primary-strong); outline: none; }
.audit-log-details__summary::-webkit-details-marker { display: none; }
.audit-log-details__summary::after { content: '\25BC'; font-size: 0.75rem; transition: transform 0.2s ease; }
.audit-log-details[open] .audit-log-details__summary::after { transform: rotate(-180deg); }
.audit-log-details__content { margin-top: var(--spacing-sm); }

.offcanvas .app-sidebar__link { color: var(--text-primary); }
.offcanvas .app-sidebar__link.is-disabled { color: rgba(100, 116, 139, 0.6); }
.offcanvas .app-sidebar__link.is-active {
    color: var(--accent-primary); border-left: none; background: rgba(59, 130, 246, 0.12);
}

.text-muted-soft { color: rgba(100, 116, 139, 0.85) !important; }
.alert-elevated { border-radius: var(--radius-md); border: none; box-shadow: var(--shadow-soft); }
.card-header-tight { padding: var(--spacing-sm) var(--spacing-md); border-bottom: 1px solid rgba(15, 23, 42, 0.06); }
.card-body-comfy { padding: var(--spacing-md); }
.flex-gap-sm { gap: var(--spacing-sm); }
.flex-gap-md { gap: var(--spacing-md); }
.btn-ghost { background: transparent; border: 1px solid var(--border-subtle); color: var(--text-primary); }
.btn-ghost:hover, .btn-ghost:focus { background: var(--surface-muted); }
.shadow-soft { box-shadow: var(--shadow-soft) !important; }
.border-subtle { border: 1px solid var(--border-subtle) !important; }
.bg-overlay-muted { background: rgba(15, 23, 42, 0.04) !important; }
.th-text-muted { color: var(--text-muted) !important; }
.form-legend { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.app-section-title { font-size: 1.125rem; font-weight: 600; }

/* ===== Service Insight ===== */
.service-insight {
    display: flex; flex-direction: column; gap: var(--spacing-lg);
}
.service-insight__container {
    /* ← 여기서 좌우 스크롤 분리용 컨테이너 고정 높이 + 내부 스크롤 */
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--spacing-lg);
    overflow: hidden;          /* 내부 컬럼만 스크롤 */
    min-height: 0;             /* 그리드 자식 overflow 동작 보장 */
    /* 높이는 JS가 런타임에 직접 설정 (뷰포트-오프셋 계산) */
}
@media (min-width: 992px) { .service-insight__container { grid-template-columns: 280px 1fr; } }
@media (max-width: 991.98px) { .service-insight__container { grid-template-columns: 1fr; } }

/* 좌우 컬럼을 각각 스크롤 */
.service-insight__metrics,
.service-insight__chart {
    height: 100%;          /* 컨테이너 높이를 채움 (JS가 container 높이 세팅) */
    overflow-y: auto;      /* 각자 스크롤 */
    min-height: 0;
}

.service-insight__metrics { display: flex; flex-direction: column; gap: var(--spacing-md); }
.service-insight__metrics-header { display: flex; flex-direction: column; gap: 0.25rem; }

.service-insight__metric-list { display: flex; flex-direction: column; gap: 0.75rem; }
.service-insight__metric-button {
    width: 100%; text-align: left; background: transparent;
    border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex; flex-direction: column; gap: 0.35rem;
    color: inherit; transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.service-insight__metric-button:hover,
.service-insight__metric-button:focus-visible {
    border-color: var(--accent-primary);
    box-shadow: 0 12px 32px rgba(59,130,246,0.12);
    transform: translateY(-1px); outline: none;
}
.service-insight__metric-button.is-active {
    border-color: var(--accent-primary);
    background: rgba(59,130,246,0.08);
    box-shadow: 0 16px 32px rgba(59,130,246,0.18);
}
.service-insight__metric-label { font-weight: 600; }
.service-insight__metric-badge { align-self: flex-start; }

.service-insight__chart { min-width: 0; }

.service-insight__chart-surface { position: relative; height: 360px; }
@media (min-width: 1200px) { .service-insight__chart-surface { height: 420px; } }
.service-insight__chart-surface canvas { width: 100% !important; height: 100%; display: block; }

.service-insight__unit { font-weight: 600; }
.service-insight__empty-state {
    border: 1px dashed var(--border-subtle); border-radius: var(--radius-lg);
    background: rgba(15, 23, 42, 0.02);
}

/* 질문형 인사이트(호환) */
.siq-grid { display: grid; gap: var(--spacing-lg); }
@media (min-width: 992px) { .siq-grid--two { grid-template-columns: 1fr 1fr; } }
.siq-card__surface { position: relative; height: 360px; }
@media (min-width: 1200px) { .siq-card__surface { height: 420px; } }
.siq-card__surface canvas { width: 100% !important; height: 100%; display: block; }

/* ===== DnD 플롯/그룹 UI ===== */
.si-sidebar { display: flex; flex-direction: column; gap: var(--spacing-md); }
.si-sidebar__header { display: flex; align-items: baseline; justify-content: space-between; padding: 0 var(--spacing-sm); }
.si-sidebar__title { font-weight: 700; }
.si-sidebar__hint  { color: var(--text-muted); font-size: 0.85rem; }
.si-groups { display: flex; flex-direction: column; gap: var(--spacing-sm); }

.si-group { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--surface-primary); overflow: hidden; }
.si-group[open] .si-group__summary { border-bottom: 1px solid var(--border-subtle); }
.si-group__summary {
    display: flex; align-items: center; justify-content: space-between; gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md); cursor: pointer;
}
.si-group__title { font-weight: 600; }
.si-group__tools { display: inline-flex; gap: 0.25rem; }
.si-group__btn {
    border: 1px solid var(--border-subtle); background: transparent; border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem; font-size: 0.8rem; color: var(--text-muted);
}
.si-group__btn:hover { color: var(--accent-primary); border-color: var(--accent-primary); }
.si-group__body { padding: var(--spacing-sm) var(--spacing-md); }
.si-chip-list { display: flex; flex-direction: column; gap: 0.5rem; }

.si-chip {
    display: flex; align-items: center; gap: 0.6rem;
    border: 1px dashed var(--border-subtle);
    background: rgba(15,23,42,0.02);
    border-radius: var(--radius-md);
    padding: 0.45rem 0.6rem;
    cursor: grab; user-select: none;
}
.si-chip:active { cursor: grabbing; }
.si-chip:hover { border-color: var(--accent-primary); background: rgba(59,130,246,0.06); }
.si-chip__dot { width: 10px; height: 10px; border-radius: 999px; flex: 0 0 10px; }
.si-chip__label { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.si-chip__meta { color: var(--text-muted); font-size: 0.8rem; }
.si-grip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; opacity: .6; }

.si-plots { display: flex; flex-direction: column; gap: var(--spacing-md); }
.si-plots__toolbar { display: flex; justify-content: space-between; align-items: center; padding: 0 0.25rem; }
.si-size { display: inline-flex; gap: 0.4rem; }
.si-size__btn.is-active { border-color: var(--accent-primary); color: var(--accent-primary); }

.si-plot-grid { display: grid; gap: var(--spacing-lg); grid-template-columns: 1fr; }
@media (min-width: 1200px) { .si-plot-grid { grid-template-columns: 1fr 1fr; } }

.si-plot-card {
    border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
    background: var(--surface-primary); box-shadow: var(--shadow-soft); overflow: hidden;
}
.si-plot__header {
    display: flex; align-items: center; justify-content: space-between; gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md); border-bottom: 1px solid var(--border-subtle);
}
.si-plot__title { font-weight: 600; }
.si-plot__tools { display: inline-flex; gap: 0.35rem; }

.si-plot__datasets {
    display: flex; flex-wrap: wrap; gap: 0.35rem;
    padding: 0.5rem var(--spacing-md);
    border-bottom: 1px dashed var(--border-subtle);
    background: rgba(15,23,42,0.02);
}
.si-ds-chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    border: 1px solid var(--border-subtle);
    border-radius: 999px; padding: 0.2rem 0.5rem;
    font-size: 0.85rem; background: #fff; cursor: grab;
}
.si-ds-chip:active { cursor: grabbing; }
.si-ds-chip__dot { width: 8px; height: 8px; border-radius: 999px; }
.si-ds-chip__rm { border: none; background: transparent; color: var(--text-muted); padding: 0; line-height: 1; font-size: 1rem; cursor: pointer; }
.si-ds-chip__rm:hover { color: var(--accent-danger); }

.si-dropzone {
    display: flex; align-items: center; justify-content: center;
    padding: var(--spacing-md);
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-muted); font-weight: 600;
    transition: border-color .15s ease, background-color .15s ease;
}
.si-dropzone.is-dragover { border-color: var(--accent-primary); background: rgba(59,130,246,0.06); }

.si-plot__surface { position: relative; }
.si-plots[data-size="compact"] .si-plot__surface { height: 240px; }
.si-plots[data-size="cozy"]    .si-plot__surface { height: 300px; }
.si-plots[data-size="roomy"]   .si-plot__surface { height: 420px; }
.si-plot__surface canvas { width: 100% !important; height: 100%; display: block; }

.si-empty {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); pointer-events: none;
}

/* ===== Role management ===== */
.role-tabs {
    border: 0;
    background: rgba(226, 232, 240, 0.6);
    padding: 0.4rem;
    border-radius: 999px;
    display: inline-flex;
    gap: 0.25rem;
}

.role-tabs .nav-link {
    border: 0;
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.55rem 1.4rem;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.role-tabs .nav-link:hover {
    color: var(--text-primary);
}

.role-tabs .nav-link.active {
    background: linear-gradient(135deg, #6366f1, #22d3ee);
    color: #ffffff;
    box-shadow: 0 12px 30px rgba(14, 165, 233, 0.35);
}

.role-tabs .nav-link.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.role-token-grid,
.role-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.role-token-button,
.role-token {
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    background: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1.2;
    color: var(--text-primary);
}

.role-token-button {
    cursor: pointer;
    background: var(--surface-primary);
    border-color: rgba(59, 130, 246, 0.24);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.role-token-button:hover,
.role-token-button:focus-visible {
    border-color: var(--accent-primary);
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.16);
    transform: translateY(-1px);
    outline: none;
}

.role-chip {
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    background: var(--surface-muted);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1.2;
}

.role-chip--action {
    cursor: pointer;
    background: var(--surface-primary);
    border-color: rgba(59, 130, 246, 0.24);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.role-chip--action:hover,
.role-chip--action:focus-visible {
    border-color: var(--accent-primary);
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.16);
    transform: translateY(-1px);
    outline: none;
}

.role-chip__cta {
    font-size: 0.75rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.role-permission-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.role-team-table {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    background: #fff;
}

.role-team-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border-subtle);
}

.role-team-table th,
.role-team-table td {
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.role-team-table tbody tr:last-child td {
    border-bottom: 0;
}

.role-team-table tbody tr.table-active {
    background: rgba(99, 102, 241, 0.08);
}

.role-permission-modal__dialog {
    max-width: 460px;
}

.role-permission-modal {
    border-radius: var(--radius-xl);
    border: none;
    box-shadow: var(--shadow-overlay);
    overflow: hidden;
}
.role-permission-modal__eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--accent-primary-strong);
    margin-bottom: 0.35rem;
}
.role-permission-modal__description {
    font-size: 0.95rem;
}
.permission-carousel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.permission-carousel__viewport {
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(15, 23, 42, 0.03));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
    min-height: 110px;
    display: flex;
    align-items: center;
}

.permission-carousel__slide {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.permission-carousel__label {
    font-weight: 600;
    font-size: 1rem;
}

.permission-carousel__key {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.05);
    border-radius: 999px;
    padding: 0.15rem 0.85rem;
    align-self: flex-start;
}

.permission-carousel__controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.permission-carousel__nav {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: #fff;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.permission-carousel__nav:disabled {
    opacity: 0.5;
    box-shadow: none;
}

.permission-carousel__nav:not(:disabled):hover,
.permission-carousel__nav:not(:disabled):focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
}

.permission-carousel__counter {
    flex: 1;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
}
.permission-modal-empty {
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1rem;
    color: var(--text-muted);
    text-align: center;
}
.team-member-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.team-member-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    display: flex;
    gap: 0.85rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.team-member-card.is-active {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-soft);
}
.team-member-card__avatar {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: var(--surface-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
.team-member-card__body {
    flex: 1;
    min-width: 0;
}
.team-role-card-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.team-role-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    background: var(--surface-primary);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.team-role-card__avatar {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: var(--surface-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}
.team-role-card__roles {
    min-height: 88px;
}
.role-editor-panel summary {
    cursor: pointer;
    font-weight: 600;
}
.permission-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.role-option,
.permission-option {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.65rem;
    gap: 0.5rem;
    align-items: flex-start;
}
.role-template-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.role-template-item {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    text-decoration: none;
    color: inherit;
    display: block;
}
.role-template-item.is-active {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.08);
}

.role-manage-region {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    background: var(--surface-primary);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.role-manage-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.role-manage-eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--accent-primary);
}

.role-manage-form {
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    background: var(--surface-muted);
}

.role-manage-columns {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 1.25rem;
}

.role-manage-column {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: #fff;
    padding: 1rem 1.25rem;
    min-height: 320px;
}

.role-manage-column__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.role-manage-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.role-manage-list-item {
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 0.65rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.role-manage-list-item:hover,
.role-manage-list-item.is-active {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.08);
}

.role-manage-column--detail {
    padding: 0;
}

.role-manage-empty {
    height: 100%;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem;
}

.role-manage-detail {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem;
}

.role-manage-detail__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.role-manage-code {
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    background: rgba(15, 23, 42, 0.06);
    border-radius: 999px;
    padding: 0.2rem 0.85rem;
    display: inline-flex;
    align-items: center;
    text-transform: uppercase;
}

.role-permission-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.role-permission-chip {
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--surface-muted);
}

.role-permission-chip__label {
    font-weight: 600;
}

.role-permission-chip__key {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

@media (max-width: 991.98px) {
    .role-manage-columns {
        grid-template-columns: 1fr;
    }

    .role-manage-column {
        min-height: auto;
    }
}
