/**
 * WMS Helpdesk & Ticket System Styles — SupportCandy-inspired UI
 *
 * Covers:
 *   • Ticket list (customer + support views)
 *   • Ticket detail / thread
 *   • Reply composer (Reply tab + Internal Note tab)
 *   • Ticket info sidebar
 *   • Priority indicators + SLA badges
 *
 * Depends on: wms-public.css for :root design tokens.
 *
 * @package WarrantyManagement
 * @since   2.2.0
 */

/* ─────────────────────────────────────────────────────────────────────────────
   HELPDESK LAYOUT — two-pane (sidebar list + detail) on large screens
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-wrap {
	display: flex;
	flex-direction: column;
	min-height: 0;
	font-family: var(--wms-font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

/* Two-column split: ticket queue left + detail right */
.wms-hd-split {
	display: grid;
	grid-template-columns: 360px 1fr;
	gap: 0;
	min-height: 600px;
	border: 1px solid var(--wms-border);
	border-radius: var(--wms-radius-lg);
	overflow: hidden;
	box-shadow: var(--wms-shadow-lg);
	background: var(--wms-surface);
}

/* ─────────────────────────────────────────────────────────────────────────────
   QUEUE PANEL (left column)
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-queue {
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--wms-border);
	background: var(--wms-surface2);
	overflow: hidden;
	position: sticky;
	top: 32px; /* WP admin bar height */
	height: calc(100vh - 64px);
	overflow-y: auto;
}

/* Queue top bar: title + new ticket button */
.wms-hd-queue-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px 12px;
	border-bottom: 1px solid var(--wms-border);
	background: var(--wms-surface);
}

.wms-hd-queue-title {
	font-size: 15px;
	font-weight: 700;
	color: var(--wms-text);
	margin: 0;
}

/* Filter tabs inside the queue */
.wms-hd-filter-bar {
	display: flex;
	gap: 0;
	overflow-x: auto;
	padding: 0 12px;
	border-bottom: 1px solid var(--wms-border);
	background: var(--wms-surface);
	scrollbar-width: none;
}
.wms-hd-filter-bar::-webkit-scrollbar { display: none; }

.wms-hd-filter-btn {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 12px;
	font-size: 12px;
	font-weight: 600;
	color: var(--wms-muted);
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	cursor: pointer;
	white-space: nowrap;
	transition: color .15s, border-color .15s;
	text-decoration: none;
}
.wms-hd-filter-btn:hover {
	color: var(--wms-text);
	text-decoration: none;
}
.wms-hd-filter-btn.is-active,
.wms-hd-filter-btn[aria-selected="true"] {
	color: var(--wms-primary);
	border-bottom-color: var(--wms-primary);
}

.wms-hd-filter-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	font-size: 10px;
	font-weight: 700;
	border-radius: 10px;
	background: var(--wms-border);
	color: var(--wms-muted);
	line-height: 1;
}
.wms-hd-filter-btn.is-active .wms-hd-filter-count { background: var(--wms-primary-light); color: var(--wms-primary); }
.wms-hd-filter-count--danger  { background: var(--wms-status-new-bg, #F7E4DE) !important; color: var(--wms-status-new, #C8553D) !important; }
.wms-hd-filter-count--warning { background: var(--wms-status-open-bg, #F6ECD4) !important; color: var(--wms-status-open, #B7791F) !important; }
.wms-hd-filter-count--purple  { background: var(--wms-status-blue-bg, #DFE7EE) !important; color: var(--wms-status-blue, #4A6B88) !important; }

/* Search row */
.wms-hd-search-row {
	padding: 10px 12px;
	border-bottom: 1px solid var(--wms-border);
	background: var(--wms-surface);
}

.wms-hd-search {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--wms-bg);
	border: 1px solid var(--wms-border);
	border-radius: var(--wms-radius-sm);
	padding: 6px 10px;
	font-size: 13px;
	color: var(--wms-muted);
}
.wms-hd-search svg { flex-shrink: 0; opacity: .5; }
.wms-hd-search input {
	border: none;
	background: none;
	outline: none;
	width: 100%;
	font-size: 13px;
	color: var(--wms-text);
}
.wms-hd-search input::placeholder { color: var(--wms-faint); }

/* Scrollable ticket list */
.wms-hd-list {
	flex: 1;
	overflow-y: auto;
	padding: 6px 0;
	scrollbar-width: thin;
	scrollbar-color: var(--wms-border) transparent;
}
.wms-hd-list::-webkit-scrollbar { width: 4px; }
.wms-hd-list::-webkit-scrollbar-thumb { background: var(--wms-border); border-radius: 2px; }

/* ─────────────────────────────────────────────────────────────────────────────
   TICKET ROW (in list)
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-row {
	display: flex;
	gap: 0;
	align-items: stretch;
	overflow: hidden; /* Safari border-radius stripe fix (A.10.3) */
	cursor: pointer;
	text-decoration: none;
	position: relative;
	background: var(--wms-surface2);
	border-bottom: 1px solid var(--wms-border);
	transition: background .12s;
}
.wms-hd-row:hover { background: var(--wms-primary-light); text-decoration: none; }
.wms-hd-row.is-active { background: var(--wms-primary-light); }
.wms-hd-row.is-active::after {
	content: '';
	position: absolute;
	right: 0;
	top: 0;
	bottom: 0;
	width: 3px;
	background: var(--wms-primary);
}

/* Left priority stripe */
.wms-hd-row-stripe {
	width: 4px;
	flex-shrink: 0;
	border-radius: 0;
}
.wms-hd-row-stripe--new       { background: var(--wms-status-new, #C8553D); }
.wms-hd-row-stripe--open      { background: var(--wms-status-open, #B7791F); }
.wms-hd-row-stripe--replied   { background: var(--wms-status-ok, #5A7A4E); }
.wms-hd-row-stripe--escalated { background: var(--wms-status-blue, #4A6B88); }
.wms-hd-row-stripe--closed    { background: var(--wms-status-closed, #8B8779); }
.wms-hd-row-stripe--urgent    { background: var(--wms-status-new, #C8553D); }
.wms-hd-row-stripe--high      { background: var(--wms-orange, #CF6A2A); }
.wms-hd-row-stripe--medium    { background: var(--wms-status-open, #B7791F); }
.wms-hd-row-stripe--low       { background: var(--wms-status-closed, #8B8779); }

/* Row body */
.wms-hd-row-body {
	flex: 1;
	padding: 12px 14px 10px;
	min-width: 0;
}

.wms-hd-row-top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 3px;
}

.wms-hd-row-subject {
	font-size: 13px;
	font-weight: 600;
	color: var(--wms-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 1;
	min-width: 0;
}
.wms-hd-row.is-unread .wms-hd-row-subject {
	font-weight: 700;
}
.wms-hd-row.is-unread .wms-hd-row-subject::before {
	content: '';
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--wms-primary);
	margin-right: 6px;
	vertical-align: middle;
	flex-shrink: 0;
}

.wms-hd-row-time {
	font-size: 11px;
	color: var(--wms-faint);
	white-space: nowrap;
	flex-shrink: 0;
}

.wms-hd-row-meta {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin-top: 4px;
}

.wms-hd-row-customer {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	color: var(--wms-muted);
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 1;
}

.wms-hd-row-num {
	font-size: 11px;
	color: var(--wms-faint);
	font-family: monospace;
	flex-shrink: 0;
}

/* Inline mini-badges on rows */
.wms-hd-row .wms-hd-tags {
	display: flex;
	gap: 4px;
	align-items: center;
}

/* ─────────────────────────────────────────────────────────────────────────────
   STATUS BADGES (scoped, overrides wms-public.css for helpdesk contexts)
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 8px;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.5;
	white-space: nowrap;
	letter-spacing: .02em;
}
.wms-hd-badge--dot::before {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}

/* Status colors — warm muted tones */
.wms-hd-badge--new       { background: var(--wms-status-new-bg, #F7E4DE); color: var(--wms-status-new, #C8553D); }
.wms-hd-badge--open      { background: var(--wms-status-open-bg, #F6ECD4); color: var(--wms-status-open, #B7791F); }
.wms-hd-badge--replied   { background: var(--wms-status-ok-bg, #E4ECD9); color: var(--wms-status-ok, #5A7A4E); }
.wms-hd-badge--pending   { background: var(--wms-status-open-bg, #F6ECD4); color: var(--wms-status-open, #B7791F); }
.wms-hd-badge--escalated { background: var(--wms-status-blue-bg, #DFE7EE); color: var(--wms-status-blue, #4A6B88); }
.wms-hd-badge--closed    { background: var(--wms-status-transit-bg, #ECE8DF); color: var(--wms-status-closed, #8B8779); }
.wms-hd-badge--resolved  { background: var(--wms-status-ok-bg, #E4ECD9); color: var(--wms-status-ok, #5A7A4E); }

/* Priority colors */
.wms-hd-badge--urgent  { background: var(--wms-status-new-bg, #F7E4DE); color: var(--wms-status-new, #C8553D); }
.wms-hd-badge--high    { background: var(--wms-day-alert-bg, #F7E3CF); color: var(--wms-day-alert, #CF6A2A); }
.wms-hd-badge--medium  { background: var(--wms-status-open-bg, #F6ECD4); color: var(--wms-status-open, #B7791F); }
.wms-hd-badge--low     { background: var(--wms-status-transit-bg, #ECE8DF); color: var(--wms-status-closed, #8B8779); }

/* SLA + speed-up badges */
.wms-hd-badge--sla {
	background: var(--wms-status-new-bg, #F7E4DE);
	color: var(--wms-status-new, #C8553D);
	animation: wms-hd-pulse 1.6s ease-in-out infinite;
}
.wms-hd-badge--speedup {
	background: var(--wms-day-alert-bg, #F7E3CF);
	color: var(--wms-day-alert, #CF6A2A);
}

@keyframes wms-hd-pulse {
	0%, 100% { opacity: 1; }
	50%       { opacity: .6; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   DETAIL PANE (right column)
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-detail {
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	background: var(--wms-surface);
}

/* Detail header */
.wms-hd-detail-header {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 18px 24px 14px;
	border-bottom: 1px solid var(--wms-border);
	background: var(--wms-surface);
	flex-shrink: 0;
}

.wms-hd-detail-title-row {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	min-width: 0;
}

.wms-hd-detail-num {
	font-size: 12px;
	font-weight: 600;
	color: var(--wms-faint);
	font-family: monospace;
	flex-shrink: 0;
}

.wms-hd-detail-subject {
	font-size: 17px;
	font-weight: 700;
	color: var(--wms-text);
	margin: 0;
	flex: 1;
	min-width: 0;
}

.wms-hd-detail-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

/* Detail meta row: customer, product, dates */
.wms-hd-detail-meta {
	display: flex;
	align-items: center;
	gap: 16px;
	font-size: 12px;
	color: var(--wms-muted);
	flex-wrap: wrap;
}
.wms-hd-detail-meta strong { color: var(--wms-text2); }

/* ─────────────────────────────────────────────────────────────────────────────
   DETAIL BODY — scrollable thread + sidebar
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-detail-body {
	display: flex;
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

.wms-hd-thread-wrap {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--wms-border) transparent;
}
.wms-hd-thread-wrap::-webkit-scrollbar { width: 4px; }
.wms-hd-thread-wrap::-webkit-scrollbar-thumb { background: var(--wms-border); border-radius: 2px; }

.wms-hd-thread {
	padding: 20px 24px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MESSAGE BUBBLES
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-msg {
	display: flex;
	gap: 12px;
	align-items: flex-start;
}

/* Agent/staff: right-aligned */
.wms-hd-msg--agent {
	flex-direction: row-reverse;
}
.wms-hd-msg--agent .wms-hd-msg-meta {
	text-align: right;
}
.wms-hd-msg--agent .wms-hd-bubble {
	background: var(--wms-primary-light);
	border-color: rgba(234,90,0,.25);
	border-top-right-radius: 4px;
	border-top-left-radius: var(--wms-radius-md);
}

/* Customer: left-aligned */
.wms-hd-msg--customer .wms-hd-bubble {
	background: var(--wms-surface2);
	border-color: var(--wms-border);
	border-top-left-radius: 4px;
}

/* Internal note: full-width */
.wms-hd-msg--internal {
	flex-direction: column;
}
.wms-hd-msg--internal .wms-hd-bubble {
	background: var(--wms-status-open-bg, #F6ECD4);
	border: 1.5px dashed var(--wms-status-open, #B7791F);
	border-radius: var(--wms-radius-sm);
	width: 100%;
}
.wms-hd-msg--internal .wms-hd-msg-avatar {
	background: var(--wms-status-open, #B7791F);
	color: #fff;
}
.wms-hd-internal-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
}
.wms-hd-internal-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--wms-status-open, #B7791F);
}

/* Avatar circle */
.wms-hd-msg-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--wms-primary);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	user-select: none;
}
.wms-hd-msg-avatar--customer {
	background: var(--wms-status-transit, #8B8779);
}
.wms-hd-msg-avatar--support {
	background: var(--wms-primary, #EA5A00);
}
.wms-hd-msg-avatar--superuser {
	background: var(--wms-status-blue, #4A6B88);
}

/* Bubble */
.wms-hd-bubble {
	border: 1px solid transparent;
	border-radius: var(--wms-radius-md);
	padding: 12px 16px;
	font-size: 14px;
	line-height: 1.7;
	color: var(--wms-text2);
	word-break: break-word;
	min-width: 120px;
}
.wms-hd-bubble p:last-child { margin-bottom: 0; }
.wms-hd-bubble p:first-child { margin-top: 0; }

/* Message meta: sender name + timestamp */
.wms-hd-msg-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-width: 78%;
	min-width: 0;
}
.wms-hd-msg--internal .wms-hd-msg-body {
	max-width: 100%;
}

.wms-hd-msg-meta {
	font-size: 11px;
	color: var(--wms-faint);
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}
.wms-hd-msg-sender {
	font-weight: 600;
	color: var(--wms-muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   TICKET INFO SIDEBAR (inside detail pane)
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-info-sidebar {
	width: 230px;
	flex-shrink: 0;
	border-left: 1px solid var(--wms-border);
	overflow-y: auto;
	background: var(--wms-surface2);
	scrollbar-width: thin;
	scrollbar-color: var(--wms-border) transparent;
}
.wms-hd-info-sidebar::-webkit-scrollbar { width: 3px; }
.wms-hd-info-sidebar::-webkit-scrollbar-thumb { background: var(--wms-border); }

.wms-hd-info-section {
	padding: 14px 16px;
	border-bottom: 1px solid var(--wms-border);
}
.wms-hd-info-section-title {
	font-size: 10px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: .1em;
	color: var(--wms-faint);
	margin-bottom: 10px;
}
.wms-hd-info-row {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-bottom: 10px;
}
.wms-hd-info-row:last-child { margin-bottom: 0; }
.wms-hd-info-label {
	font-size: 11px;
	color: var(--wms-faint);
	font-weight: 500;
}
.wms-hd-info-value {
	font-size: 13px;
	color: var(--wms-text2);
	font-weight: 600;
	word-break: break-all;
}
.wms-hd-info-value a {
	color: var(--wms-primary);
	text-decoration: none;
}
.wms-hd-info-value a:hover { text-decoration: underline; }

/* Customer mini-profile */
.wms-hd-customer-card {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}
.wms-hd-customer-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: linear-gradient(135deg, #64748b, #475569);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.wms-hd-customer-name {
	font-size: 13px;
	font-weight: 700;
	color: var(--wms-text);
}
.wms-hd-customer-email {
	font-size: 11px;
	color: var(--wms-muted);
	word-break: break-all;
}

/* ─────────────────────────────────────────────────────────────────────────────
   REPLY COMPOSER
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-composer {
	border-top: 1px solid var(--wms-border);
	background: var(--wms-surface);
	flex-shrink: 0;
	position: relative;
}

/* Composer mode tabs */
.wms-hd-composer-tabs {
	display: flex;
	gap: 0;
	border-bottom: 1px solid var(--wms-border);
	padding: 0 16px;
}
.wms-hd-composer-tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 14px;
	font-size: 12px;
	font-weight: 600;
	color: var(--wms-muted);
	background: none;
	border: none;
	border-bottom: 2.5px solid transparent;
	cursor: pointer;
	transition: color .15s, border-color .15s;
}
.wms-hd-composer-tab:hover { color: var(--wms-text); }
.wms-hd-composer-tab.is-active {
	color: var(--wms-primary);
	border-bottom-color: var(--wms-primary);
}
.wms-hd-composer-tab--note.is-active {
	color: #b45309;
	border-bottom-color: #fbbf24;
}

/* Composer body */
.wms-hd-composer-body {
	padding: 12px 16px 8px;
}

.wms-hd-composer-body textarea {
	width: 100%;
	min-height: 100px;
	max-height: 220px;
	padding: 10px 14px;
	border: 1px solid var(--wms-border);
	border-radius: var(--wms-radius-sm);
	font-size: 14px;
	line-height: 1.6;
	color: var(--wms-text);
	resize: vertical;
	font-family: inherit;
	background: var(--wms-bg);
	transition: border-color .15s, box-shadow .15s;
}
.wms-hd-composer-body textarea:focus {
	border-color: var(--wms-primary);
	box-shadow: var(--wms-focus-ring);
	outline: none;
	background: var(--wms-surface);
}
.wms-hd-composer-body.is-note textarea {
	background: #fefce8;
	border-color: #fbbf24;
}
.wms-hd-composer-body.is-note textarea:focus {
	border-color: #f59e0b;
	box-shadow: 0 0 0 3px rgba(251,191,36,.15);
}

/* Composer footer */
.wms-hd-composer-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 16px 14px;
	gap: 10px;
	flex-wrap: wrap;
}
.wms-hd-composer-footer-left { display: flex; gap: 8px; align-items: center; }
.wms-hd-composer-footer-right { display: flex; gap: 8px; align-items: center; }

/* Status-change dropdown in composer */
.wms-hd-status-dropdown {
	display: flex;
	align-items: center;
	gap: 0;
	border-radius: var(--wms-radius-sm);
	overflow: hidden;
	border: 1.5px solid var(--wms-primary);
}
.wms-hd-status-dropdown .wms-btn {
	border-radius: 0;
	border: none;
	box-shadow: none;
}
.wms-hd-status-dropdown .wms-hd-split-arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	background: var(--wms-primary-dark);
	border-left: 1px solid var(--wms-primary-dark);
	cursor: pointer;
	font-size: 11px;
	color: #fff;
}

/* ─────────────────────────────────────────────────────────────────────────────
   FULL-WIDTH TICKET LIST (customer portal, not two-pane)
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-list-page {
	background: var(--wms-surface);
	border-radius: var(--wms-radius-lg);
	border: 1px solid var(--wms-border);
	box-shadow: var(--wms-shadow-md);
	overflow: hidden;
}

.wms-hd-list-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 24px 16px;
	border-bottom: 1px solid var(--wms-border);
	flex-wrap: wrap;
}
.wms-hd-list-header h2 {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: var(--wms-text);
}

/* Full-width row (customer view) */
.wms-hd-row-fw {
	display: flex;
	align-items: center;
	gap: 0;
	overflow: hidden; /* Safari border-radius stripe fix (A.10.3) */
	text-decoration: none;
	border-bottom: 1px solid var(--wms-border);
	transition: background .12s;
	background: var(--wms-surface);
	position: relative;
}
.wms-hd-row-fw:hover { background: var(--wms-primary-light); text-decoration: none; }
.wms-hd-row-fw.is-unread { background: #f8faff; }

.wms-hd-row-fw .wms-hd-row-stripe { width: 4px; align-self: stretch; flex-shrink: 0; }

.wms-hd-row-fw-body {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 8px 16px;
	padding: 14px 18px;
	flex: 1;
	min-width: 0;
	align-items: center;
}

.wms-hd-row-fw-left { min-width: 0; }
.wms-hd-row-fw-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }

.wms-hd-row-fw-subject {
	font-size: 14px;
	font-weight: 600;
	color: var(--wms-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 8px;
}
.wms-hd-row-fw.is-unread .wms-hd-row-fw-subject::before {
	content: '';
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--wms-primary);
	flex-shrink: 0;
}
.wms-hd-row-fw-product {
	font-size: 12px;
	color: var(--wms-muted);
	margin-top: 3px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────────────────
   NEW TICKET DRAWER / FORM
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-new-form-wrap {
	margin-top: 24px;
}

.wms-hd-new-form-trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 20px;
	background: var(--wms-primary-light);
	border: 1.5px solid rgba(234,90,0,.3);
	border-radius: var(--wms-radius-md);
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	color: var(--wms-primary);
	transition: background .15s;
	user-select: none;
}
.wms-hd-new-form-trigger:hover { background: #fde8d8; }
.wms-hd-new-form-trigger-icon { font-size: 18px; transition: transform .2s; }
.wms-hd-new-form-trigger.is-open .wms-hd-new-form-trigger-icon { transform: rotate(45deg); }

.wms-hd-new-form-body {
	display: none;
	border: 1px solid var(--wms-border);
	border-top: none;
	border-radius: 0 0 var(--wms-radius-md) var(--wms-radius-md);
	padding: 24px;
	background: var(--wms-surface);
}
.wms-hd-new-form-body.is-open { display: block; }

/* ─────────────────────────────────────────────────────────────────────────────
   EMPTY STATES
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 60px 32px;
	color: var(--wms-muted);
	text-align: center;
}
.wms-hd-empty-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	border-radius: 16px;
	background: var(--wms-surface2);
	border: 1px solid var(--wms-border);
	color: var(--wms-muted);
	margin: 0 auto 16px;
}

/* Chevron in list rows */
.wms-hd-row-chevron {
	padding: 0 10px;
	color: var(--wms-faint);
	display: flex;
	align-items: center;
	flex-shrink: 0;
}
.wms-hd-empty-title {
	font-size: 16px;
	font-weight: 700;
	color: var(--wms-text2);
	margin-bottom: 6px;
}
.wms-hd-empty-sub {
	font-size: 13px;
	color: var(--wms-muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   SUPPORT DASHBOARD — full-page helpdesk layout
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-page {
	background: var(--wms-bg);
}

/* Stats bar (superuser overview) */
.wms-hd-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 12px;
	padding: 0 0 20px;
}

.wms-hd-stat {
	background: var(--wms-surface);
	border: 1px solid var(--wms-border);
	border-radius: var(--wms-radius-md);
	padding: 16px 20px;
	box-shadow: var(--wms-shadow-sm);
	display: flex;
	flex-direction: column;
	gap: 4px;
	transition: box-shadow .15s;
}
.wms-hd-stat:hover { box-shadow: var(--wms-shadow-md); }

.wms-hd-stat-value {
	font-size: 28px;
	font-weight: 800;
	color: var(--wms-text);
	line-height: 1;
}
.wms-hd-stat-value--danger  { color: #dc2626; }
.wms-hd-stat-value--warning { color: #d97706; }
.wms-hd-stat-value--success { color: #16a34a; }
.wms-hd-stat-value--purple  { color: #7c3aed; }
.wms-hd-stat-value--blue    { color: var(--wms-primary, #EA5A00); }

.wms-hd-stat-label {
	font-size: 12px;
	color: var(--wms-muted);
	font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
	/* Stack two-pane into single column */
	.wms-hd-split {
		grid-template-columns: 1fr;
	}
	.wms-hd-queue {
		border-right: none;
		border-bottom: 1px solid var(--wms-border);
		max-height: 360px;
	}
	/* Hide sidebar on small screens */
	.wms-hd-info-sidebar {
		display: none;
	}
	.wms-hd-msg-body { max-width: 90%; }
}

@media (max-width: 640px) {
	.wms-hd-detail-header { padding: 14px 16px 10px; }
	.wms-hd-thread { padding: 14px 16px; gap: 14px; }
	.wms-hd-composer-footer { flex-direction: column; align-items: stretch; }
	.wms-hd-detail-subject { font-size: 15px; }
	.wms-hd-list-header { padding: 14px 16px 12px; }
	.wms-hd-row-fw-body { padding: 12px 14px; }
	.wms-hd-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   REGISTRATION ROW — inline approve/reject actions
   ───────────────────────────────────────────────────────────────────────────── */

.wms-hd-reg-actions {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

/* Row feedback flash on approve/reject */
.wms-hd-row.wms-row-success,
.wms-hd-reg-row.wms-row-success {
	background: #f0fdf4;
	border-left: 3px solid #16a34a;
	transition: background .2s;
}
.wms-hd-row.wms-row-danger,
.wms-hd-reg-row.wms-row-danger {
	background: #fef2f2;
	border-left: 3px solid #dc2626;
	transition: background .2s;
}

/* Tech dashboard case row feedback */
.wms-row-success td { background: #f0fdf4 !important; }
.wms-row-danger  td { background: #fef2f2 !important; }

/* Text helpers for machine model cell */
.wms-text-sm   { font-size: 13px; color: var(--wms-text2); }
.wms-text-muted { color: var(--wms-muted); }

/* ─────────────────────────────────────────────────────────────────────────────
   TECH DASHBOARD — Inline case expand row (A.11.2)
   ───────────────────────────────────────────────────────────────────────────── */

.wms-tech-expand-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border: 1px solid var(--wms-border);
	border-radius: var(--wms-radius-sm);
	background: var(--wms-surface);
	cursor: pointer;
	color: var(--wms-muted);
	transition: background .15s, color .15s, border-color .15s;
	padding: 0;
}
.wms-tech-expand-btn:hover {
	background: var(--wms-primary-light);
	color: var(--wms-primary);
	border-color: var(--wms-primary);
}
.wms-tech-expand-btn[aria-expanded="true"] {
	background: var(--wms-primary-light);
	color: var(--wms-primary);
	border-color: var(--wms-primary);
}
.wms-tech-expand-icon {
	transition: transform .2s;
	display: block;
}
.wms-tech-expand-btn[aria-expanded="true"] .wms-tech-expand-icon {
	transform: rotate(180deg);
}

.wms-case-expand-row td.wms-case-expand-cell {
	background: #fafaf9;
	border-top: none;
	padding: 0;
}
.wms-case-expand-content {
	padding: 16px 20px 20px;
	display: flex;
	align-items: center;
	gap: 12px;
}
.wms-case-expand-content.is-loaded {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 16px;
	align-items: start;
}
@media (max-width: 768px) {
	.wms-case-expand-content.is-loaded { grid-template-columns: 1fr; }
}
.wms-case-expand-group { display: flex; flex-direction: column; gap: 4px; }
.wms-case-expand-label {
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--wms-muted);
	font-weight: 600;
}
.wms-case-expand-value {
	font-size: 13px;
	color: var(--wms-text);
	line-height: 1.5;
}
.wms-case-expand-value a {
	color: var(--wms-primary);
	text-decoration: none;
	font-weight: 600;
}
.wms-case-expand-value a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════════
   KPI ROW
   ═══════════════════════════════════════════════════════════════════════════ */
.wms-kpi-row {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	margin-bottom: 20px;
}
.wms-kpi-card {
	background: var(--wms-surface);
	border: 1px solid var(--wms-border);
	border-radius: var(--wms-radius);
	padding: 16px 20px;
}
.wms-kpi-value {
	font-family: var(--wms-font-serif);
	font-size: 30px;
	font-weight: 400;
	line-height: 1;
	letter-spacing: -0.02em;
	color: var(--wms-text);
}
.wms-kpi-value--danger  { color: var(--wms-danger); }
.wms-kpi-value--warning { color: var(--wms-warning); }
.wms-kpi-value--success { color: var(--wms-success); }
.wms-kpi-value--purple  { color: #7c3aed; }
.wms-kpi-label {
	font-size: 12px;
	color: var(--wms-muted);
	margin-top: 5px;
}
.wms-kpi-delta {
	font-size: 11px;
	color: var(--wms-faint, #b0a898);
	margin-top: 2px;
}
@media (max-width: 900px) {
	.wms-kpi-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
	.wms-kpi-row { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TICKET INBOX (flat table card)
   ═══════════════════════════════════════════════════════════════════════════ */
.wms-ticket-inbox {
	background: var(--wms-surface);
	border: 1px solid var(--wms-border);
	border-radius: var(--wms-radius);
	overflow: hidden;
}
.wms-ticket-inbox-head {
	padding: 12px 20px;
	border-bottom: 1px solid var(--wms-border);
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}
.wms-tbl-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	display: inline-block;
	flex-shrink: 0;
}
.wms-tbl-dot--new       { background: var(--wms-danger); }
.wms-tbl-dot--replied   { background: var(--wms-muted-color, #8a8070); }
.wms-tbl-dot--escalated { background: #7c3aed; }
.wms-tbl-dot--closed    { background: var(--wms-success); }
.wms-tbl-dot--open      { background: var(--wms-warning); }

/* Ticket detail page header — tighter than default .wms-page-header */
.wms-hd-wrap .wms-page-header h2 {
	font-size: 20px;
}
.wms-hd-wrap .wms-page-eyebrow {
	font-size: 11px;
	letter-spacing: .07em;
	color: var(--wms-muted);
	text-transform: uppercase;
	margin-bottom: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   3-COLUMN TICKET DETAIL LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */
.wms-tkt-layout {
	display: grid;
	grid-template-columns: 240px 1fr 220px;
	gap: 16px;
	align-items: start;
}
.wms-tkt-sidebar,
.wms-tkt-aside {
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.wms-tkt-main {
	display: flex;
	flex-direction: column;
	gap: 0;
	min-height: 0;
}
.wms-tkt-card {
	background: var(--wms-surface);
	border: 1px solid var(--wms-border);
	border-radius: var(--wms-radius);
	overflow: hidden;
}
.wms-tkt-card-title {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--wms-muted);
	padding: 10px 14px 8px;
	border-bottom: 1px solid var(--wms-border);
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.wms-tkt-card-body {
	padding: 14px;
}
.wms-tkt-cust-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}
.wms-tkt-cust-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--wms-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 600;
	flex-shrink: 0;
}
.wms-tkt-cust-name  { font-weight: 600; font-size: 13px; line-height: 1.3; }
.wms-tkt-cust-email { font-size: 11.5px; color: var(--wms-muted); margin-top: 1px; }
.wms-tkt-divider {
	height: 1px;
	background: var(--wms-border);
	margin: 10px 0;
}
.wms-tkt-kv {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
	font-size: 12px;
	padding: 3px 0;
}
.wms-tkt-kv-label { color: var(--wms-muted); flex-shrink: 0; }
.wms-tkt-kv-value { text-align: right; font-size: 12px; }

/* Thread card — flex column so thread scrolls and composer stays pinned */
.wms-tkt-thread-card {
	background: var(--wms-surface);
	border: 1px solid var(--wms-border);
	border-radius: var(--wms-radius);
	display: flex;
	flex-direction: column;
}
.wms-tkt-thread {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	max-height: 460px;
	min-height: 180px;
}
.wms-tkt-thread-card .wms-hd-composer {
	flex-shrink: 0;
	border-top: 1px solid var(--wms-border);
}

/* Quick actions */
.wms-tkt-qactions {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.wms-tkt-qactions .wms-btn {
	justify-content: flex-start;
	width: 100%;
}

/* Activity timeline */
.wms-tl {
	display: flex;
	flex-direction: column;
}
.wms-tl-item {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding-bottom: 14px;
	position: relative;
}
.wms-tl-item:last-child { padding-bottom: 0; }
.wms-tl-item::before {
	content: '';
	position: absolute;
	left: 7px;
	top: 15px;
	bottom: 0;
	width: 1px;
	background: var(--wms-border);
}
.wms-tl-item:last-child::before { display: none; }
.wms-tl-dot {
	width: 15px;
	height: 15px;
	border-radius: 50%;
	border: 2px solid var(--wms-border);
	background: var(--wms-bg);
	flex-shrink: 0;
	margin-top: 1px;
	position: relative;
	z-index: 1;
}
.wms-tl-item.is-done    .wms-tl-dot { background: var(--wms-success); border-color: var(--wms-success); }
.wms-tl-item.is-current .wms-tl-dot { background: var(--wms-primary); border-color: var(--wms-primary); }
.wms-tl-body { flex: 1; min-width: 0; }
.wms-tl-time  { font-size: 10.5px; color: var(--wms-faint, #b0a898); }
.wms-tl-title { font-size: 12.5px; color: var(--wms-text); line-height: 1.4; }

/* Escalation panel */
.wms-escalate-panel { display: none; }
.wms-escalate-panel.is-open { display: flex; flex-direction: column; }
.wms-escalate-panel .wms-tkt-card-title { color: var(--wms-danger); }
.wms-escalate-warning {
	background: #fff8f0;
	border: 1px solid #f5c18a;
	border-radius: 6px;
	padding: 10px 12px;
	font-size: 12px;
	color: #92400e;
	margin-bottom: 12px;
	line-height: 1.5;
}
.wms-escalate-field {
	margin-bottom: 12px;
}
.wms-escalate-field label {
	display: block;
	font-size: 11.5px;
	font-weight: 600;
	color: var(--wms-muted);
	margin-bottom: 5px;
}
.wms-escalate-field select,
.wms-escalate-field textarea {
	width: 100%;
	font-family: var(--wms-font-sans);
	font-size: 12.5px;
	background: var(--wms-bg);
	border: 1px solid var(--wms-border);
	border-radius: 6px;
	padding: 7px 10px;
	color: var(--wms-text);
	box-sizing: border-box;
}
.wms-escalate-field select:focus,
.wms-escalate-field textarea:focus {
	outline: none;
	border-color: var(--wms-primary);
}
.wms-escalate-field textarea { resize: vertical; min-height: 80px; }

/* Responsive breakpoints */
@media (max-width: 1100px) {
	.wms-tkt-layout { grid-template-columns: 220px 1fr; }
	.wms-tkt-aside  { display: none; }
}
@media (max-width: 768px) {
	.wms-tkt-layout { grid-template-columns: 1fr; }
	.wms-tkt-sidebar { display: none; }
	.wms-tkt-thread { max-height: 320px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CUSTOMER TICKETS 2-PANE
   ═══════════════════════════════════════════════════════════════════════════ */
.wms-tickets-split {
	display: grid;
	grid-template-columns: 300px 1fr;
	gap: 0;
	border: 1px solid var(--wms-border);
	border-radius: var(--wms-radius);
	overflow: hidden;
	background: var(--wms-surface);
	min-height: 480px;
}
.wms-tickets-list {
	border-right: 1px solid var(--wms-border);
	overflow-y: auto;
	max-height: 70vh;
}
.wms-tickets-list-head {
	padding: 12px 16px;
	border-bottom: 1px solid var(--wms-border);
	font-size: 12px;
	font-weight: 600;
	color: var(--wms-muted);
	text-transform: uppercase;
	letter-spacing: .05em;
	display: flex;
	align-items: center;
	justify-content: space-between;
	position: sticky;
	top: 0;
	background: var(--wms-surface);
	z-index: 1;
}
.wms-tickets-conv {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-height: 0;
}
.wms-tickets-conv-empty {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	color: var(--wms-muted);
	padding: 40px 20px;
	text-align: center;
}
.wms-tickets-conv-empty svg { opacity: .35; }
.wms-tkt-row {
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--wms-border);
	cursor: pointer;
	transition: background .12s;
	text-decoration: none;
	color: inherit;
}
.wms-tkt-row:hover       { background: #faf9f7; }
.wms-tkt-row.is-active   { background: #fdf5ee; border-left: 3px solid var(--wms-primary); padding-left: 13px; }
.wms-tkt-row-subj        { font-weight: 500; font-size: 13px; line-height: 1.4; }
.wms-tkt-row-meta        { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--wms-muted); flex-wrap: wrap; }
.wms-tkt-conv-head {
	padding: 14px 18px;
	border-bottom: 1px solid var(--wms-border);
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}
.wms-tkt-conv-thread {
	flex: 1;
	overflow-y: auto;
	padding: 16px 18px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-height: 45vh;
}
@media (max-width: 640px) {
	.wms-tickets-split { grid-template-columns: 1fr; min-height: 0; }
	.wms-tickets-list  { display: none; max-height: 50vh; }
	.wms-tickets-list.is-shown { display: block; }
	.wms-tickets-list.is-shown ~ .wms-tickets-conv { display: none; }
}
