/* ── Custom sidebar (replaces the default tab list) ──────────── */

.sidebarInner {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 16px 12px 24px;
}

.backButton {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: var(--text-secondary);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.12s, color 0.12s;
}

.backButton:hover {
	background: var(--background-modifier-hover);
	color: var(--text-primary);
}

.sidebarSectionTitle {
	padding: 6px 12px 2px;
	font-size: 0.6875rem;
	font-weight: 700;
	color: var(--text-tertiary);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.createButton {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 8px 12px;
	border: 1px solid var(--background-header-secondary);
	border-radius: 6px;
	background: var(--background-tertiary);
	color: var(--text-primary);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.12s, border-color 0.12s;
}

.createButton:hover {
	background: var(--background-modifier-hover);
	border-color: var(--background-modifier-accent);
}

.createButton:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.roleList {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.roleItem {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 8px 12px;
	border: 1px solid transparent;
	border-radius: 6px;
	background: transparent;
	color: var(--text-primary);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.12s, border-color 0.12s;
}

.roleItem:hover {
	background: var(--background-modifier-hover);
}

.roleItemActive,
.roleItemActive:hover {
	background: var(--background-modifier-selected, var(--background-modifier-hover));
	border-color: var(--brand-primary, #5865f2);
}

.roleDot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex-shrink: 0;
}

.roleName {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.emptyNote {
	padding: 8px 12px;
	font-size: 0.8125rem;
	color: var(--text-tertiary);
}

/* ── Main editor column ──────────────────────────────────────── */

.editorEmpty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	gap: 8px;
	color: var(--text-tertiary);
	font-size: 0.9375rem;
}

.headerRow {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 24px;
}

.headerText {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.headerTitle {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--text-primary);
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.headerSubtitle {
	font-size: 0.8125rem;
	color: var(--text-tertiary);
	margin: 0;
}

.deleteButton {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid var(--background-header-secondary);
	border-radius: 6px;
	background: var(--background-tertiary);
	color: var(--text-primary);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
	flex-shrink: 0;
	transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.deleteButton:hover {
	background: rgba(237, 66, 69, 0.12);
	border-color: rgba(237, 66, 69, 0.4);
	color: var(--status-danger, #ed4245);
}

.deleteButton:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ── Section headings ────────────────────────────────────────── */

.sectionHeading {
	font-size: 0.6875rem;
	font-weight: 700;
	color: var(--text-tertiary);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin: 24px 0 10px;
}

.sectionHeading:first-of-type {
	margin-top: 0;
}

/* ── Display row ─────────────────────────────────────────────── */

.displayRow {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-bottom: 24px;
}

.fieldGroup {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.fieldLabel {
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.textInput {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--background-header-secondary);
	border-radius: 6px;
	background: var(--background-tertiary);
	color: var(--text-primary);
	font: inherit;
	font-size: 0.9375rem;
	outline: none;
	transition: border-color 0.12s;
}

.textInput:focus {
	border-color: var(--brand-primary);
}

.textInput:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Color field wraps the hex input + a native color picker button so
   the user can either type a colour or pick one. */

.colorWrap {
	position: relative;
	display: flex;
	align-items: center;
}

.colorInput {
	padding-right: 42px;
}

.colorSwatchButton {
	position: absolute;
	right: 6px;
	top: 50%;
	transform: translateY(-50%);
	width: 30px;
	height: 30px;
	padding: 0;
	border: 1px solid var(--background-header-secondary);
	border-radius: 6px;
	background: transparent;
	cursor: pointer;
	overflow: hidden;
}

.colorSwatchInner {
	display: block;
	width: 100%;
	height: 100%;
}

.hiddenColorInput {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	border: none;
	padding: 0;
	background: none;
}

.fieldHelp {
	font-size: 0.75rem;
	color: var(--text-tertiary);
	margin-top: 2px;
}

/* ── Toggle row (hoist + mentionable) ────────────────────────── */

.toggleRow {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 0;
	border-top: 1px solid var(--background-modifier-accent);
}

.toggleRow:first-of-type {
	border-top: none;
}

.toggleText {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.toggleTitle {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--text-primary);
}

.toggleDescription {
	font-size: 0.8125rem;
	color: var(--text-tertiary);
}

.toggle {
	position: relative;
	width: 40px;
	height: 22px;
	border: none;
	border-radius: 999px;
	background: var(--background-header-secondary);
	cursor: pointer;
	flex-shrink: 0;
	transition: background-color 0.15s;
}

.toggleOn {
	background: var(--brand-primary, #5865f2);
}

.toggleThumb {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #ffffff;
	transition: transform 0.15s ease;
}

.toggleOn .toggleThumb {
	transform: translateX(18px);
}

.toggle:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ── Clear permissions row ───────────────────────────────────── */

.clearRow {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin: 16px 0 8px;
	padding: 14px 0 0;
	border-top: 1px solid var(--background-modifier-accent);
}

.clearText {
	flex: 1;
	font-size: 0.8125rem;
	color: var(--text-tertiary);
	margin: 0;
	line-height: 1.4;
}

.clearButton {
	padding: 8px 14px;
	border: 1px solid var(--background-header-secondary);
	border-radius: 6px;
	background: var(--background-tertiary);
	color: var(--text-primary);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
	flex-shrink: 0;
	transition: background-color 0.12s, border-color 0.12s;
}

.clearButton:hover {
	background: var(--background-modifier-hover);
}

.clearButton:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ── Permission search row ───────────────────────────────────── */

.searchRow {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.searchWrap {
	position: relative;
	flex: 1;
	min-width: 0;
}

.searchIcon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-tertiary);
	pointer-events: none;
}

.searchInput {
	width: 100%;
	padding: 10px 12px 10px 36px;
	border: 1px solid var(--background-header-secondary);
	border-radius: 6px;
	background: var(--background-tertiary);
	color: var(--text-primary);
	font: inherit;
	font-size: 0.875rem;
	outline: none;
	transition: border-color 0.12s;
}

.searchInput:focus {
	border-color: var(--brand-primary);
}

/* ── Permissions list ────────────────────────────────────────── */

.permissionList {
	display: flex;
	flex-direction: column;
}

.permissionRow {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 0;
	border-top: 1px solid var(--background-modifier-accent);
}

.permissionRow:first-of-type {
	border-top: none;
}

.permissionInfo {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.permissionTitle {
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--text-primary);
}

.permissionDescription {
	font-size: 0.8125rem;
	color: var(--text-tertiary);
	line-height: 1.4;
}

.permissionEmpty {
	padding: 24px 0;
	text-align: center;
	font-size: 0.875rem;
	color: var(--text-tertiary);
}

.errorBanner {
	padding: 10px 12px;
	margin-bottom: 16px;
	background: rgba(234, 80, 80, 0.12);
	border: 1px solid rgba(234, 80, 80, 0.4);
	border-radius: 6px;
	color: var(--text-primary);
	font-size: 0.8125rem;
}

/* ── Unsaved-changes bar (replaces the modal content header) ── */

.unsavedBar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	padding: 0;
}

.unsavedText {
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--text-primary);
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.unsavedActions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}

.resetButton {
	padding: 8px 18px;
	border: none;
	border-radius: 6px;
	background: var(--background-tertiary);
	color: var(--text-primary);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.12s;
}

.resetButton:hover:not(:disabled) {
	background: var(--background-modifier-hover);
}

.resetButton:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.saveButton {
	padding: 8px 18px;
	border: none;
	border-radius: 6px;
	background: var(--brand-primary, #5865f2);
	color: #ffffff;
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
	transition: filter 0.12s;
}

.saveButton:hover:not(:disabled) {
	filter: brightness(1.1);
}

.saveButton:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ── Mobile full-screen role list ────────────────────────────── */

.mobileList {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 16px;
}

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

.mobileListTitle {
	font-size: 1.125rem;
	font-weight: 700;
	color: var(--text-primary);
	margin: 0;
}

.mobileCreateButton {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 14px;
	border: none;
	border-radius: 8px;
	background: var(--background-tertiary);
	color: var(--text-primary);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
	flex-shrink: 0;
	transition: background-color 0.12s;
}

.mobileCreateButton:hover {
	background: var(--background-modifier-hover);
}

.mobileRoleRow {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 14px 16px;
	border: 1px solid var(--background-header-secondary);
	border-radius: 10px;
	background: var(--background-secondary);
	color: var(--text-primary);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.12s;
}

.mobileRoleRow:hover,
.mobileRoleRow:active {
	background: var(--background-modifier-hover);
}

.mobileRoleRowName {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mobileRoleRowCaret {
	color: var(--text-tertiary);
	flex-shrink: 0;
}

/* ── Mobile editor back-to-roles row ─────────────────────────── */

.mobileBackRow {
	display: flex;
	margin-bottom: 12px;
}

.mobileBackButton {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid var(--background-header-secondary);
	border-radius: 6px;
	background: var(--background-tertiary);
	color: var(--text-primary);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.12s;
}

.mobileBackButton:hover {
	background: var(--background-modifier-hover);
}
