/* Tabwise — browser-style tabs that adapt to light or dark admin themes. */
.tw-bar {
	--tw-line: rgba(128, 128, 128, .32);
	--tw-soft: rgba(128, 128, 128, .13);
	--tw-hover: rgba(128, 128, 128, .22);
	--tw-accent: #3b82f6;
	clear: both;
	position: relative;
	display: flex;
	align-items: flex-end;
	gap: 6px;
	width: 100%;
	margin: 26px 0 18px;
	padding: 0 2px;
	box-sizing: border-box;
	border-bottom: 1px solid var(--tw-line);
	font-size: 13px;
	line-height: 1;
}
.tw-custom-tabs, .tw-system-tabs {
	display: flex;
	align-items: flex-end;
	gap: 4px;
	padding: 10px 0 1px;   /* room for the raised active tab and its baseline cover */
	margin-bottom: -1px;
}
.tw-custom-tabs { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.tw-system-tabs { flex: 0 0 auto; }
.tw-spacer { flex: 1 1 24px; min-width: 24px; }
.tw-ghost[hidden] { display: none !important; }

/* ---------- Tab ---------- */
.tw-tab {
	--tw-c: #8c8f94;
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
	height: 38px;
	padding: 0 6px 0 12px;
	border: 1px solid rgba(128, 128, 128, .22);
	border-bottom: 0;
	border-radius: 9px 9px 0 0;
	background: linear-gradient(color-mix(in srgb, var(--tw-c) 7%, transparent), color-mix(in srgb, var(--tw-c) 7%, transparent)), var(--tw-soft);
	color: inherit;
	opacity: 1;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	user-select: none;
	-webkit-user-drag: none;
	transition: background .15s, opacity .15s, border-color .15s;
}
.tw-tab:not(.is-system) { cursor: grab; }
.tw-tab::before {
	content: "";
	position: absolute;
	left: 8px; right: 8px; top: 0;
	height: 3px;
	border-radius: 0 0 3px 3px;
	background: var(--tw-c);
	opacity: .9;
}
.tw-tab:hover, .tw-tab:focus { background: var(--tw-hover); color: inherit; opacity: 1; box-shadow: none; }
.tw-tab:focus-visible { outline: 2px solid var(--tw-c); outline-offset: -2px; }

.tw-tab.is-active {
	z-index: 2;
	height: 46px;
	padding-left: 14px;
	opacity: 1;
	border: 2px solid var(--tw-c);
	border-bottom: 0;
	background:
		linear-gradient(color-mix(in srgb, var(--tw-c) 30%, transparent), color-mix(in srgb, var(--tw-c) 12%, transparent)),
		var(--tw-bg, #f0f0f1);
	box-shadow: 0 -4px 14px color-mix(in srgb, var(--tw-c) 35%, transparent);
	font-weight: 700;
}
.tw-tab.is-active:hover { background:
		linear-gradient(color-mix(in srgb, var(--tw-c) 30%, transparent), color-mix(in srgb, var(--tw-c) 12%, transparent)),
		var(--tw-bg, #f0f0f1); }
.tw-tab.is-active::before { left: -2px; right: -2px; top: -2px; height: 4px; border-radius: 9px 9px 0 0; opacity: 1; }
.tw-tab.is-active .tw-ico svg { width: 18px; height: 18px; }
/* Dim the others a touch so the selected one pops. */
.tw-bar .tw-tab:not(.is-active) { opacity: .78; }
.tw-bar .tw-tab:not(.is-active):hover { opacity: 1; }
.tw-tab.is-active::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: -2px;
	height: 3px;
	background: inherit;
}

.tw-ico svg { width: 17px; height: 17px; display: block; fill: var(--tw-c); }
.tw-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.tw-count {
	min-width: 20px; padding: 3px 6px; box-sizing: border-box;
	border-radius: 10px; background: var(--tw-hover);
	font-size: 11px; font-weight: 500; text-align: center;
}
.tw-tab.is-active .tw-count { background: var(--tw-c); color: #fff; font-weight: 700; }
.tw-star svg { width: 12px; height: 12px; display: block; fill: #eab308; }

.tw-dots {
	display: inline-flex; align-items: center; justify-content: center;
	width: 26px; height: 26px; padding: 0; margin: 0;
	border: 0; border-radius: 6px; background: transparent;
	color: inherit; cursor: pointer; opacity: .45;
}
.tw-dots svg { width: 16px; height: 16px; fill: currentColor; }
.tw-tab:hover .tw-dots { opacity: .8; }
.tw-dots:hover, .tw-tab.is-menu .tw-dots { opacity: 1; background: var(--tw-hover); }

.tw-tab.is-new { animation: tw-in .5s ease; }
@keyframes tw-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- "N more tabs" ghost tab ---------- */
.tw-ghost {
	display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
	height: 38px; padding: 0 12px; margin: 0;
	border: 1px dashed var(--tw-line); border-bottom: 0; border-radius: 9px 9px 0 0;
	background: transparent; color: inherit; font: inherit; font-size: 12px;
	cursor: pointer; opacity: .8; white-space: nowrap;
}
.tw-ghost svg { width: 15px; height: 15px; fill: currentColor; }
.tw-ghost:hover { opacity: 1; background: var(--tw-soft); }
.tw-ghost.is-active { opacity: 1; border-style: solid; font-weight: 600; }

/* ---------- New tab button ---------- */
.tw-add {
	display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
	height: 38px; padding: 0 14px 0 8px; margin: 0 0 0 2px;
	border: 1px dashed color-mix(in srgb, var(--tw-accent) 60%, transparent); border-bottom: 0;
	border-radius: 9px 9px 0 0;
	background: color-mix(in srgb, var(--tw-accent) 8%, transparent);
	color: inherit; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
	transition: background .15s, border-color .15s;
}
.tw-add svg {
	width: 22px; height: 22px; padding: 3px; box-sizing: border-box;
	border-radius: 50%; background: var(--tw-accent); fill: #fff;
}
.tw-add:hover { background: color-mix(in srgb, var(--tw-accent) 18%, transparent); border-style: solid; border-color: var(--tw-accent); }

/* ---------- Drag & drop ---------- */
.tw-drag-clone {
	position: fixed !important; top: 0; left: 0; z-index: 100002;
	margin: 0 !important; pointer-events: none;
	opacity: .96 !important; cursor: grabbing;
	border: 1px solid var(--tw-line) !important; border-radius: 9px !important;
	background: var(--tw-bg, #fff);
	box-shadow: 0 14px 32px rgba(0, 0, 0, .38), 0 0 0 2px var(--tw-c, var(--tw-accent));
	transition: none !important;
}
.tw-drag-clone .tw-dots { visibility: hidden; }
.tw-tab.is-placeholder, .tw-oitem.is-placeholder {
	opacity: .3 !important;
	outline: 2px dashed var(--tw-line);
	outline-offset: -3px;
}
body.tw-sorting, body.tw-sorting * { cursor: grabbing !important; user-select: none !important; }

.tw-indicator {
	display: none;
	position: absolute; z-index: 10;
	width: 3px; border-radius: 3px;
	background: var(--tw-accent, #3b82f6);
	box-shadow: 0 0 0 3px color-mix(in srgb, #3b82f6 25%, transparent), 0 0 12px #3b82f6;
	pointer-events: none;
}
.tw-indicator::before, .tw-indicator::after {
	content: ""; position: absolute; left: 50%;
	width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%;
	background: #3b82f6;
}
.tw-indicator::before { top: -4px; }
.tw-indicator::after { bottom: -4px; }
.tw-indicator.is-h { height: 3px; width: auto; }
.tw-indicator.is-h::before, .tw-indicator.is-h::after { top: -3px; bottom: auto; left: auto; margin: 0; }
.tw-indicator.is-h::before { left: -4px; }
.tw-indicator.is-h::after { right: -4px; }

.tw-bar.is-row-drag .tw-tab:not([data-key="all"]) { outline: 1px dashed var(--tw-line); outline-offset: -3px; }
.tw-tab.is-drop { background: color-mix(in srgb, var(--tw-c) 30%, transparent); opacity: 1; outline: 2px solid var(--tw-c) !important; }
.tw-grip { display: inline-block; vertical-align: -3px; margin-right: 4px; cursor: grab; opacity: .25; }
.tw-grip svg { width: 14px; height: 14px; fill: currentColor; }
tr:hover .tw-grip { opacity: .7; }
#the-list.tw-loading { opacity: .45; pointer-events: none; transition: opacity .1s; }

/* ---------- Popovers ---------- */
.tw-pop {
	position: absolute; z-index: 100000;
	min-width: 210px; padding: 6px;
	border: 1px solid rgba(128, 128, 128, .3); border-radius: 12px;
	background: var(--tw-bg, #fff); color: inherit;
	box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
	font-size: 13px;
}
.tw-item {
	display: flex; align-items: center; gap: 10px; width: 100%;
	padding: 8px 10px; margin: 0; border: 0; border-radius: 6px;
	background: transparent; color: inherit; font: inherit; text-align: left;
	cursor: pointer; box-sizing: border-box;
}
.tw-item svg { width: 16px; height: 16px; fill: currentColor; opacity: .75; flex: 0 0 auto; }
.tw-item:hover, .tw-item:focus { background: rgba(128, 128, 128, .15); }
.tw-item.is-danger { color: #ef4444; }
.tw-item.is-danger svg { opacity: 1; }
.tw-item em { margin-left: auto; font-style: normal; opacity: .6; font-size: 12px; }
.tw-item.is-current { font-weight: 600; background: rgba(128, 128, 128, .12); }
.tw-oitem { cursor: grab; }
.tw-oico svg { fill: var(--tw-c) !important; opacity: 1 !important; }
.tw-overflow { min-width: 240px; }
.tw-overflow-list { position: relative; }
.tw-menu-title { padding: 6px 10px 8px; font-weight: 600; font-size: 12px; }
.tw-menu-title em { font-style: normal; font-weight: 400; opacity: .55; margin-left: 6px; }
.tw-sep { height: 1px; margin: 5px 4px; background: rgba(128, 128, 128, .25); }
.tw-note { padding: 8px 10px; opacity: .7; }

.tw-form { display: flex; flex-direction: column; gap: 8px; padding: 6px; min-width: 250px; }
.tw-form label { font-weight: 600; }
.tw-form input[type="text"] { width: 100%; }
.tw-row { display: flex; align-items: center; gap: 8px; }
.tw-end { justify-content: flex-end; }

/* ---------- Color picker ---------- */
.tw-cp { display: flex; flex-direction: column; gap: 12px; width: 272px; padding: 8px; }
.tw-cp-head { display: flex; align-items: center; gap: 8px; }
.tw-cp-chip { width: 18px; height: 18px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .5); }

.tw-sv {
	position: relative; height: 160px; border-radius: 10px;
	cursor: crosshair; touch-action: none;
	background-image: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent);
}
.tw-sv-thumb {
	position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px;
	border: 2px solid #fff; border-radius: 50%; box-sizing: border-box;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .4);
	pointer-events: none;
}
.tw-slider {
	position: relative; height: 12px; border-radius: 6px;
	cursor: pointer; touch-action: none;
}
.tw-hue { background: linear-gradient(90deg, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%); }
.tw-alpha {
	background-color: #fff;
	background-image:
		linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%);
	background-size: 8px 8px;
	background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}
.tw-alpha-fill { position: absolute; inset: 0; border-radius: 6px; }
.tw-thumb {
	position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
	border: 3px solid #fff; border-radius: 50%; box-sizing: border-box;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 2px 5px rgba(0, 0, 0, .35);
	pointer-events: none;
}
.tw-alpha .tw-thumb { background: transparent; }

.tw-cp-inputs { display: flex; gap: 6px; align-items: stretch; }
.tw-cp-inputs select.tw-fmt { flex: 0 0 74px; min-height: 34px; padding: 0 22px 0 8px; font-size: 13px; }
.tw-vals { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; }
.tw-vals input { flex: 1 1 0; min-width: 0; width: 100%; min-height: 34px; padding: 0 4px; text-align: center; font-size: 13px; }
.tw-hexwrap {
	display: flex; align-items: center; flex: 1 1 auto; min-width: 0;
	border: 1px solid rgba(128, 128, 128, .45); border-radius: 4px; padding-left: 8px;
}
.tw-hexwrap span { opacity: .55; }
.tw-hexwrap input { border: 0 !important; box-shadow: none !important; background: transparent !important; text-align: left; text-transform: uppercase; font-family: ui-monospace, Menlo, monospace; }
.tw-pct {
	display: flex; align-items: center; flex: 0 0 64px;
	border: 1px solid rgba(128, 128, 128, .45); border-radius: 4px; padding-right: 6px;
}
.tw-pct input { width: 100%; min-width: 0; min-height: 32px; border: 0 !important; box-shadow: none !important; background: transparent !important; text-align: right; padding: 0 2px; font-size: 13px; }
.tw-pct span { opacity: .6; }
.tw-pct input::-webkit-inner-spin-button { display: none; }

.tw-cp-saved-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 12px; margin-top: 2px; }
.tw-link { border: 0; background: none; padding: 2px 4px; color: inherit; font: inherit; font-weight: 500; opacity: .75; cursor: pointer; border-radius: 4px; }
.tw-link:hover { opacity: 1; background: var(--tw-hover, rgba(128, 128, 128, .15)); }
.tw-cp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px; justify-items: center; }
.tw-cp-grid[hidden] { display: none; }
.tw-custom { padding-top: 9px; border-top: 1px dashed rgba(128, 128, 128, .3); }
.tw-sw {
	position: relative; width: 28px; height: 28px; padding: 0; margin: 0;
	border: 0; border-radius: 50%; cursor: pointer;
	background-color: #fff;
	background-image: linear-gradient(var(--tw-c), var(--tw-c)), linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%), linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%);
	background-size: auto, 8px 8px, 8px 8px;
	background-position: 0 0, 0 0, 4px 4px;
	transition: transform .1s;
}
.tw-sw:hover { transform: scale(1.1); }
.tw-sw.is-on { box-shadow: 0 0 0 2px var(--tw-bg, #fff), 0 0 0 4px rgba(128, 128, 128, .9); }
.tw-sw-x {
	position: absolute; top: -5px; right: -5px; display: none;
	width: 15px; height: 15px; border-radius: 50%;
	background: #1d2327; box-shadow: 0 0 0 1px rgba(255, 255, 255, .4);
}
.tw-sw-x svg { width: 11px; height: 11px; margin: 2px; fill: #fff; display: block; }
.tw-sw:hover .tw-sw-x { display: block; }

/* ---------- Toast ---------- */
.tw-toast {
	position: fixed; right: 20px; bottom: 20px; z-index: 100001;
	padding: 10px 14px; border-radius: 8px;
	background: #1d2327; color: #fff; font-size: 13px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
	opacity: 0; transform: translateY(8px); pointer-events: none;
	transition: opacity .2s, transform .2s;
}
.tw-toast.is-on { opacity: 1; transform: none; }
.tw-toast.is-error { background: #b32d2e; }

@media (max-width: 782px) {
	.tw-name { max-width: 110px; }
	.tw-add span { display: none; }
}

/* ---------- Icon picker ---------- */
.tw-ip { padding: 4px; }
.tw-ip-grid { display: grid; grid-template-columns: repeat(6, 36px); gap: 6px; padding: 4px 6px 6px; }
.tw-ip-btn {
	display: flex; align-items: center; justify-content: center;
	width: 36px; height: 36px; padding: 0; margin: 0;
	border: 1px solid transparent; border-radius: 8px;
	background: rgba(128, 128, 128, .1); color: inherit; cursor: pointer;
}
.tw-ip-btn svg { width: 20px; height: 20px; fill: currentColor; opacity: .85; }
.tw-ip-btn:hover { background: rgba(128, 128, 128, .22); }
.tw-ip-btn:hover svg { opacity: 1; }
.tw-ip-btn.is-on { border-color: var(--tw-c); background: color-mix(in srgb, var(--tw-c) 22%, transparent); }
.tw-ip-btn.is-on svg { fill: var(--tw-c); opacity: 1; }

/* ---------- Quick Edit ---------- */
.tw-qe select { max-width: 100%; }
