/* Multi Company Helpdesk: front end */

.mchd {
	--mchd-accent: #2563eb;
	--mchd-accent-contrast: #ffffff;
	--mchd-bg: transparent;
	--mchd-surface: #ffffff;
	--mchd-surface-2: #f8fafc;
	--mchd-text: #0f172a;
	--mchd-muted: #64748b;
	--mchd-border: #e2e8f0;
	--mchd-radius: 10px;
	--mchd-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
	--mchd-hero: linear-gradient(135deg, color-mix(in srgb, var(--mchd-accent) 12%, #fff), #fff);
	--mchd-success: #16a34a;
	--mchd-danger: #dc2626;
	--mchd-warning: #d97706;

	max-width: 1180px;
	margin: 0 auto;
	color: var(--mchd-text);
	background: var(--mchd-bg);
	font-size: 15px;
	line-height: 1.55;
	text-align: left;
}
.mchd *, .mchd *::before, .mchd *::after { box-sizing: border-box; }
.mchd a { color: var(--mchd-accent); text-decoration: none; }
.mchd a:hover { text-decoration: underline; }
.mchd h2, .mchd h3 { color: var(--mchd-text); line-height: 1.25; margin: 0 0 .75em; }
.mchd h2 { font-size: 1.5em; }
.mchd h3 { font-size: 1.1em; }
.mchd img { max-width: 100%; height: auto; }
.mchd .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* Skins ---------------------------------------------------------------- */
.mchd-skin-ocean   { --mchd-surface-2: #f0f9ff; --mchd-border: #cfe7f5; --mchd-hero: linear-gradient(135deg, #0ea5e9 0%, color-mix(in srgb, var(--mchd-accent) 70%, #0c4a6e) 100%); }
.mchd-skin-forest  { --mchd-surface-2: #f0fdf4; --mchd-border: #d1e9d8; --mchd-hero: linear-gradient(135deg, #15803d 0%, color-mix(in srgb, var(--mchd-accent) 60%, #14532d) 100%); }
.mchd-skin-sunset  { --mchd-surface-2: #fff7ed; --mchd-border: #fbe1c8; --mchd-hero: linear-gradient(135deg, #f97316 0%, #db2777 100%); }
.mchd-skin-midnight {
	--mchd-bg: #0b1220; --mchd-surface: #111a2e; --mchd-surface-2: #0f1729; --mchd-text: #e5e7eb; --mchd-muted: #94a3b8; --mchd-border: #1f2a44;
	--mchd-hero: linear-gradient(135deg, #111a2e, color-mix(in srgb, var(--mchd-accent) 35%, #0b1220));
	padding: 16px; border-radius: var(--mchd-radius);
}
.mchd-skin-ocean .mchd-hero, .mchd-skin-forest .mchd-hero, .mchd-skin-sunset .mchd-hero { color: #fff; }
.mchd-skin-ocean .mchd-hero h2, .mchd-skin-forest .mchd-hero h2, .mchd-skin-sunset .mchd-hero h2 { color: #fff; }
.mchd-skin-ocean .mchd-hero .mchd-btn, .mchd-skin-forest .mchd-hero .mchd-btn, .mchd-skin-sunset .mchd-hero .mchd-btn { background: #fff; color: #0f172a; border-color: #fff; }
.mchd-skin-ocean .mchd-hero .mchd-btn-ghost, .mchd-skin-forest .mchd-hero .mchd-btn-ghost, .mchd-skin-sunset .mchd-hero .mchd-btn-ghost { background: transparent; color: #fff; }
.mchd-skin-midnight input, .mchd-skin-midnight select, .mchd-skin-midnight textarea { background: #0b1220; color: var(--mchd-text); border-color: var(--mchd-border); }

/* Header / nav --------------------------------------------------------- */
.mchd-header, .mchd-topbar {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
	padding: 12px 16px; margin-bottom: 20px;
	background: var(--mchd-surface); border: 1px solid var(--mchd-border); border-radius: var(--mchd-radius); box-shadow: var(--mchd-shadow);
}
.mchd-header { border-top: 4px solid var(--mchd-accent); }
.mchd-header-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mchd-logo-link { display: inline-flex; align-items: center; gap: 10px; color: var(--mchd-text) !important; font-weight: 700; font-size: 1.1em; }
.mchd-logo-link:hover { text-decoration: none !important; }
.mchd-logo { max-height: 40px; width: auto; }
.mchd-logo-initial { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--mchd-accent); color: #fff; font-weight: 700; font-size: 1.15em; flex: none; }
.mchd-tagline { color: var(--mchd-muted); font-size: .9em; border-left: 1px solid var(--mchd-border); padding-left: 12px; }
.mchd-brand { font-weight: 700; color: var(--mchd-text) !important; }
.mchd-nav { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; }
.mchd-nav li { margin: 0; }
.mchd-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; color: var(--mchd-text); font-weight: 500; font-size: .95em; }
.mchd-nav a:hover { background: var(--mchd-surface-2); text-decoration: none; }
.mchd-nav a.is-active { background: color-mix(in srgb, var(--mchd-accent) 12%, transparent); color: var(--mchd-accent); }
.mchd-nav img.avatar { border-radius: 50%; }
.mchd-nav-toggle { display: none; background: none; border: 1px solid var(--mchd-border); border-radius: 8px; padding: 4px 10px; font-size: 1.2em; color: var(--mchd-text); cursor: pointer; }

/* Hero ----------------------------------------------------------------- */
.mchd-hero { background: var(--mchd-hero); border: 1px solid var(--mchd-border); border-radius: var(--mchd-radius); padding: 36px 28px; margin-bottom: 28px; text-align: center; }
.mchd-hero h2 { font-size: 1.9em; margin-bottom: .4em; }
.mchd-intro { max-width: 720px; margin: 0 auto 1em; }
.mchd-hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.mchd-search { display: flex; gap: 8px; max-width: 520px; margin: 16px auto 0; }
.mchd-search input { flex: 1; }

/* Buttons -------------------------------------------------------------- */
.mchd .mchd-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	padding: 9px 16px; border: 1px solid var(--mchd-accent); border-radius: 8px;
	background: var(--mchd-accent); color: var(--mchd-accent-contrast); font: inherit; font-weight: 600; font-size: .95em; line-height: 1.2;
	cursor: pointer; text-decoration: none; transition: filter .15s, background .15s;
}
.mchd .mchd-btn:hover { filter: brightness(.93); text-decoration: none; }
.mchd .mchd-btn:disabled { opacity: .6; cursor: default; }
.mchd .mchd-btn-lg { padding: 12px 22px; font-size: 1em; }
.mchd .mchd-btn-sm { padding: 5px 10px; font-size: .85em; }
.mchd .mchd-btn-block { width: 100%; }
.mchd .mchd-btn-ghost { background: transparent; color: var(--mchd-accent); }
.mchd .mchd-btn-ghost:hover { background: color-mix(in srgb, var(--mchd-accent) 10%, transparent); }
.mchd .mchd-btn-success { background: var(--mchd-success); border-color: var(--mchd-success); }
.mchd .mchd-btn-danger { background: transparent; border-color: var(--mchd-danger); color: var(--mchd-danger); }
.mchd .mchd-btn-danger:hover { background: var(--mchd-danger); color: #fff; }
.mchd .mchd-link-danger { background: none; border: 0; padding: 0; color: var(--mchd-danger); cursor: pointer; font: inherit; font-size: .9em; text-decoration: underline; }

/* Panels & layout ------------------------------------------------------ */
.mchd-panel { background: var(--mchd-surface); border: 1px solid var(--mchd-border); border-radius: var(--mchd-radius); box-shadow: var(--mchd-shadow); padding: 20px; margin-bottom: 20px; }
.mchd-panel.mchd-flush { padding: 0; overflow: hidden; }
.mchd-panel-title { padding: 16px 20px 0; }
.mchd-narrow { max-width: 640px; margin-left: auto; margin-right: auto; }
.mchd-center { text-align: center; }
.mchd-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.mchd-layout-even { grid-template-columns: 1fr 1fr; }
.mchd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 28px; }
.mchd-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--mchd-surface); border: 1px solid var(--mchd-border); border-radius: var(--mchd-radius); color: var(--mchd-text) !important; box-shadow: var(--mchd-shadow); }
.mchd-card-link { transition: transform .15s, border-color .15s; }
.mchd-card-link:hover { transform: translateY(-2px); border-color: var(--mchd-accent); text-decoration: none !important; }
.mchd-company-card { align-items: flex-start; }
.mchd-card-logo { max-height: 40px; width: auto; }
.mchd-section-title { margin-top: 8px !important; }
.mchd-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 24px; border-radius: var(--mchd-radius); background: var(--mchd-surface-2); border: 1px dashed var(--mchd-border); }
.mchd-cta h3 { margin-bottom: .3em; }
.mchd-cta p { margin: 0; color: var(--mchd-muted); }
.mchd-footer { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--mchd-border); color: var(--mchd-muted); font-size: .9em; text-align: center; }

.mchd-muted { color: var(--mchd-muted); }
.mchd-small { font-size: .85em; }
.mchd-empty { padding: 28px 20px; text-align: center; color: var(--mchd-muted); margin: 0; }
.mchd-req { color: var(--mchd-danger); }

/* Alerts --------------------------------------------------------------- */
.mchd-alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; border: 1px solid; font-weight: 500; }
.mchd-alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.mchd-alert-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.mchd-alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.mchd-alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* Forms ---------------------------------------------------------------- */
.mchd-form p { margin: 0 0 16px; }
.mchd-form label { display: block; font-weight: 600; font-size: .9em; margin-bottom: 5px; }
.mchd-form .mchd-check, .mchd-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; }
.mchd input[type=text], .mchd input[type=email], .mchd input[type=password], .mchd input[type=search], .mchd input[type=number], .mchd input[type=url], .mchd select, .mchd textarea {
	width: 100%; max-width: 100%; padding: 9px 12px; border: 1px solid var(--mchd-border); border-radius: 8px;
	background: var(--mchd-surface); color: var(--mchd-text); font: inherit; font-size: .95em; line-height: 1.4; box-shadow: none;
}
.mchd input:focus, .mchd select:focus, .mchd textarea:focus { outline: 2px solid color-mix(in srgb, var(--mchd-accent) 40%, transparent); outline-offset: 1px; border-color: var(--mchd-accent); }
.mchd input[type=color] { width: 60px; height: 40px; padding: 2px; border: 1px solid var(--mchd-border); border-radius: 8px; }
.mchd input[type=file] { font-size: .9em; }
.mchd textarea { resize: vertical; }
.mchd-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.mchd-help { display: block; color: var(--mchd-muted); font-size: .85em; margin-top: 4px; font-weight: 400; }
.mchd-fieldset { border: 1px solid var(--mchd-border); border-radius: 8px; padding: 12px 16px 0; margin: 0 0 16px; }
.mchd-fieldset legend { font-weight: 600; font-size: .9em; padding: 0 6px; }
.mchd-input-prefix { display: flex; align-items: stretch; }
.mchd-input-prefix > span { display: flex; align-items: center; padding: 0 10px; background: var(--mchd-surface-2); border: 1px solid var(--mchd-border); border-right: 0; border-radius: 8px 0 0 8px; color: var(--mchd-muted); font-size: .85em; white-space: nowrap; overflow: hidden; max-width: 55%; text-overflow: ellipsis; }
.mchd-input-prefix input { border-radius: 0 8px 8px 0 !important; }
.mchd-hp { position: absolute !important; left: -9999px; }
.mchd-form-compact p { margin-bottom: 12px; }
.mchd-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mchd-inline { display: inline-flex; gap: 6px; margin: 0; }
.mchd-inline select { width: auto; padding: 5px 8px; }
.mchd-logo-preview { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.mchd-logo-preview img { max-height: 48px; border: 1px solid var(--mchd-border); border-radius: 6px; padding: 2px; background: #fff; }
.mchd-login form p { margin-bottom: 12px; }
.mchd-login label { display: block; font-weight: 600; margin-bottom: 4px; }
.mchd-login .login-remember label { display: inline; font-weight: 400; }
.mchd-login input[type=submit] { padding: 10px 20px; border-radius: 8px; border: 0; background: var(--mchd-accent); color: #fff; font-weight: 600; cursor: pointer; }
.mchd-login-links { font-size: .9em; }

/* Toolbar, tabs, filters ---------------------------------------------- */
.mchd-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.mchd-tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--mchd-surface-2); border: 1px solid var(--mchd-border); border-radius: 10px; padding: 4px; }
.mchd-tabs a { padding: 6px 12px; border-radius: 7px; color: var(--mchd-muted); font-weight: 500; font-size: .92em; }
.mchd-tabs a:hover { color: var(--mchd-text); text-decoration: none; }
.mchd-tabs a.is-active { background: var(--mchd-surface); color: var(--mchd-text); box-shadow: var(--mchd-shadow); }
.mchd-tabs-underline { background: none; border: 0; border-bottom: 1px solid var(--mchd-border); border-radius: 0; padding: 0; margin-bottom: 20px; gap: 0; }
.mchd-tabs-underline a { border-radius: 0; padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.mchd-tabs-underline a.is-active { background: none; box-shadow: none; border-bottom-color: var(--mchd-accent); color: var(--mchd-accent); }
.mchd-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.mchd-filters input[type=search] { flex: 1 1 220px; width: auto; }
.mchd-filters select { flex: 0 1 auto; width: auto; }
.mchd-filter-note { background: var(--mchd-surface-2); padding: 8px 12px; border-radius: 8px; }

/* Tables --------------------------------------------------------------- */
.mchd-table-wrap { overflow-x: auto; }
.mchd-table { width: 100%; border-collapse: collapse; margin: 0; border: 0; font-size: .93em; }
.mchd-table th, .mchd-table td { padding: 12px 16px; border: 0; border-bottom: 1px solid var(--mchd-border); text-align: left; vertical-align: middle; background: none; }
.mchd-table th { background: var(--mchd-surface-2); font-size: .8em; text-transform: uppercase; letter-spacing: .04em; color: var(--mchd-muted); font-weight: 600; }
.mchd-table tbody tr:last-child td { border-bottom: 0; }
.mchd-table tbody tr:hover td { background: var(--mchd-surface-2); }
.mchd-row-attention td:first-child { box-shadow: inset 3px 0 0 var(--mchd-accent); }
.mchd-row-attention .mchd-ticket-link { font-weight: 700; }
.mchd-ticket-link { display: block; color: var(--mchd-text) !important; font-weight: 500; }
.mchd-ref { color: var(--mchd-muted); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 6px; }
.mchd-person { display: inline-flex; align-items: center; gap: 10px; }
.mchd-person img { border-radius: 50%; }
.mchd-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* Badges --------------------------------------------------------------- */
.mchd-badge, .mchd-status, .mchd-priority { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78em; font-weight: 600; line-height: 1.6; white-space: nowrap; background: var(--mchd-surface-2); color: var(--mchd-muted); border: 1px solid var(--mchd-border); }
.mchd-badge { background: color-mix(in srgb, var(--mchd-accent) 12%, transparent); color: var(--mchd-accent); border-color: transparent; }
.mchd-badge-muted { background: var(--mchd-surface-2); color: var(--mchd-muted); }
.mchd-badge-note { background: #fef3c7; color: #92400e; }
.mchd-role-customer { background: var(--mchd-surface-2); color: var(--mchd-muted); }
.mchd-status-open        { background: #dbeafe; color: #1d4ed8; border-color: transparent; }
.mchd-status-in_progress { background: #ede9fe; color: #6d28d9; border-color: transparent; }
.mchd-status-answered    { background: #fef3c7; color: #b45309; border-color: transparent; }
.mchd-status-on_hold     { background: #f1f5f9; color: #475569; border-color: transparent; }
.mchd-status-resolved    { background: #dcfce7; color: #15803d; border-color: transparent; }
.mchd-status-closed      { background: #e5e7eb; color: #374151; border-color: transparent; }
.mchd-priority-low    { color: #64748b; }
.mchd-priority-normal { color: #0369a1; }
.mchd-priority-high   { color: #c2410c; background: #ffedd5; border-color: transparent; }
.mchd-priority-urgent { color: #fff; background: #dc2626; border-color: transparent; }

/* Lists ---------------------------------------------------------------- */
.mchd-list { list-style: none; margin: 0; padding: 0; }
.mchd-list li { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--mchd-border); font-size: .93em; }
.mchd-list li:last-child { border-bottom: 0; }
.mchd-items { list-style: none; margin: 0; padding: 0; }
.mchd-items li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--mchd-border); }
.mchd-items li:last-child { border-bottom: 0; }
.mchd-items li > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.mchd-items li.is-editing { background: color-mix(in srgb, var(--mchd-accent) 6%, transparent); }
.mchd-dl { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 0; font-size: .93em; }
.mchd-dl dt { color: var(--mchd-muted); font-weight: 500; }
.mchd-dl dd { margin: 0; word-break: break-word; }
.mchd-profile-card { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.mchd-profile-card img { border-radius: 50%; margin-bottom: 6px; }

/* FAQ ------------------------------------------------------------------ */
.mchd-faq-search { max-width: 480px; margin-bottom: 12px; }
.mchd-faq { display: grid; gap: 8px; margin-bottom: 20px; }
.mchd-faq-item { background: var(--mchd-surface); border: 1px solid var(--mchd-border); border-radius: 8px; }
.mchd-faq-item summary { cursor: pointer; padding: 14px 16px; font-weight: 600; list-style: none; position: relative; padding-right: 40px; }
.mchd-faq-item summary::-webkit-details-marker { display: none; }
.mchd-faq-item summary::after { content: '+'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--mchd-accent); font-size: 1.3em; font-weight: 400; }
.mchd-faq-item[open] summary::after { content: '\2212'; }
.mchd-faq-answer { padding: 0 16px 14px; color: var(--mchd-text); }
.mchd-faq-answer p:last-child { margin-bottom: 0; }
.mchd-faq-compact .mchd-faq-item summary { padding: 10px 36px 10px 12px; font-size: .92em; }
.mchd-faq-compact .mchd-faq-answer { padding: 0 12px 10px; font-size: .9em; }

/* Ticket thread ------------------------------------------------------- */
.mchd-ticket-head { margin-bottom: 18px; }
.mchd-ticket-head h2 { margin: 6px 0 8px; }
.mchd-back { font-size: .9em; }
.mchd-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mchd-thread { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 14px; }
.mchd-message { display: flex; gap: 12px; margin: 0; }
.mchd-message-avatar img { border-radius: 50%; display: block; }
.mchd-message-body { flex: 1; min-width: 0; background: var(--mchd-surface); border: 1px solid var(--mchd-border); border-radius: var(--mchd-radius); padding: 14px 18px; box-shadow: var(--mchd-shadow); }
.mchd-from-staff .mchd-message-body { border-left: 3px solid var(--mchd-accent); }
.mchd-note .mchd-message-body { background: #fffbeb; border-color: #fde68a; border-left-color: #f59e0b; color: #1f2937; }
.mchd-message-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .92em; }
.mchd-message-head time { margin-left: auto; color: var(--mchd-muted); font-size: .9em; }
.mchd-message-content { word-wrap: break-word; overflow-wrap: anywhere; }
.mchd-message-content p { margin: 0 0 .8em; }
.mchd-message-content p:last-child { margin-bottom: 0; }
.mchd-message-content pre { background: var(--mchd-surface-2); padding: 10px; border-radius: 6px; overflow: auto; }
.mchd-message-content blockquote { border-left: 3px solid var(--mchd-border); margin: 0 0 .8em; padding-left: 12px; color: var(--mchd-muted); }
.mchd-attachments { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--mchd-border); display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .9em; }
.mchd-event { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; color: var(--mchd-muted); font-size: .85em; margin: 0; padding: 2px 0; }
.mchd-event time { opacity: .8; }
.mchd-reply-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: flex-end; }
.mchd-reply-actions select { width: auto; }
.mchd-reply-actions .mchd-check { margin-right: auto; }
.mchd-reply-box.is-note { background: #fffbeb; border-color: #fde68a; }
.mchd-danger-zone { text-align: center; margin-top: 8px; }

/* Rating --------------------------------------------------------------- */
.mchd-stars { color: #f59e0b; font-size: 1.2em; letter-spacing: 2px; }
.mchd-star-input { display: inline-flex; flex-direction: row-reverse; border: 0; padding: 0; margin: 0 0 12px; }
.mchd-star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mchd-star-input label { font-size: 2em; color: #d1d5db; cursor: pointer; padding: 0 2px; margin: 0; font-weight: 400; line-height: 1; }
.mchd-star-input input:checked ~ label, .mchd-star-input label:hover, .mchd-star-input label:hover ~ label { color: #f59e0b; }
.mchd-star-input input:focus-visible + label { outline: 2px solid var(--mchd-accent); border-radius: 4px; }
.mchd-rating-panel { text-align: center; }

/* Dashboard ------------------------------------------------------------ */
.mchd-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.mchd-stat { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; background: var(--mchd-surface); border: 1px solid var(--mchd-border); border-radius: var(--mchd-radius); box-shadow: var(--mchd-shadow); color: var(--mchd-text) !important; }
a.mchd-stat:hover { border-color: var(--mchd-accent); text-decoration: none !important; }
.mchd-stat-value { font-size: 2em; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mchd-stat-value small { font-size: .5em; color: var(--mchd-muted); }
.mchd-stat-label { color: var(--mchd-muted); font-size: .88em; }
.mchd-bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 6px; }
.mchd-bar { flex: 1; background: var(--mchd-accent); border-radius: 3px 3px 0 0; opacity: .85; min-height: 2px; }
.mchd-bar:hover { opacity: 1; }
.mchd-bars-axis { display: flex; justify-content: space-between; color: var(--mchd-muted); font-size: .8em; margin-top: 6px; }
.mchd-breakdown { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mchd-breakdown li { display: grid; grid-template-columns: 150px 1fr 40px; align-items: center; gap: 10px; }
.mchd-breakdown strong { text-align: right; font-variant-numeric: tabular-nums; }
.mchd-meter { height: 8px; border-radius: 99px; background: var(--mchd-surface-2); overflow: hidden; border: 1px solid var(--mchd-border); }
.mchd-meter span { display: block; height: 100%; background: var(--mchd-accent); }

/* Pagination ----------------------------------------------------------- */
.mchd-pagination { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 16px 0; }
.mchd-pagination a { min-width: 36px; padding: 6px 10px; border: 1px solid var(--mchd-border); border-radius: 8px; text-align: center; color: var(--mchd-text); background: var(--mchd-surface); }
.mchd-pagination a.is-active { background: var(--mchd-accent); border-color: var(--mchd-accent); color: #fff; }

/* Responsive ----------------------------------------------------------- */
@media (max-width: 900px) {
	.mchd-layout, .mchd-layout-even { grid-template-columns: 1fr; }
	.mchd-tagline { display: none; }
}
@media (max-width: 720px) {
	.mchd-nav-toggle { display: inline-block; }
	.mchd-header .mchd-nav { display: none; width: 100%; flex-direction: column; }
	.mchd-header .mchd-nav.is-open { display: flex; }
	.mchd-header .mchd-nav a { width: 100%; }
	.mchd-hide-sm { display: none; }
	.mchd-hero { padding: 26px 16px; }
	.mchd-hero h2 { font-size: 1.5em; }
	.mchd-message-avatar { display: none; }
	.mchd-breakdown li { grid-template-columns: 120px 1fr 32px; }
	.mchd-reply-actions { justify-content: stretch; }
	.mchd-reply-actions > * { width: 100%; }
	.mchd-input-prefix > span { display: none; }
	.mchd-input-prefix input { border-radius: 8px !important; }
	.mchd-items li { flex-direction: column; align-items: flex-start; }
}

/* Email to ticket ------------------------------------------------------ */
.mchd-email-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.mchd-email-state { display: flex; align-items: flex-start; gap: 12px; }
.mchd-email-state > div { display: flex; flex-direction: column; gap: 2px; }
.mchd-dot { width: 12px; height: 12px; border-radius: 50%; background: #cbd5e1; margin-top: 5px; flex: none; }
.mchd-dot.is-on { background: var(--mchd-success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mchd-success) 20%, transparent); }
.mchd-email-check { display: flex; align-items: center; gap: 10px; }
.mchd-label { font-weight: 600; font-size: .9em; margin-bottom: 8px !important; }
.mchd-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mchd-bullets { padding-left: 18px; margin: 8px 0 0; }
.mchd-bullets li { margin-bottom: 4px; }
.mchd-form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.mchd-copy { display: flex; gap: 6px; margin-bottom: 12px; }
.mchd-copy input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8em !important; }
.mchd-code { display: block; padding: 8px 10px; background: var(--mchd-surface-2); border: 1px solid var(--mchd-border); border-radius: 6px; font-size: .78em; word-break: break-all; }
.mchd-howto { border-top: 1px solid var(--mchd-border); padding: 8px 0; }
.mchd-howto summary { cursor: pointer; font-weight: 600; font-size: .92em; }
.mchd-regen { margin-top: 12px; }

/* Counts, phone toggle -------------------------------------------------- */
.mchd-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--mchd-danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.mchd-count[hidden] { display: none; }
.mchd-phone-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--mchd-border); background: var(--mchd-surface); color: var(--mchd-text); cursor: pointer; font-size: 1em; }
.mchd-phone-toggle:hover { border-color: var(--mchd-accent); }
.mchd-phone-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.mchd-phone-dot.is-ready { background: var(--mchd-success); }
.mchd-phone-dot.is-connecting { background: var(--mchd-warning); }
.mchd-phone-dot.is-failed { background: var(--mchd-danger); }
.mchd-phone-dot.is-call { background: var(--mchd-danger); animation: mchd-pulse 1s infinite; }
@keyframes mchd-pulse { 50% { opacity: .3; } }
.mchd-call-link { font-weight: 600; }

/* Websites -------------------------------------------------------------- */
.mchd-site-features { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mchd-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82em !important; }
.mchd-copy textarea { flex: 1; }
.mchd-embed { border-left: 4px solid var(--mchd-accent); }
.mchd-code { white-space: pre-wrap; }
.mchd-actions-left { justify-content: flex-start; }

/* Insights -------------------------------------------------------------- */
.mchd-meter-inline { display: inline-block; width: 70px; vertical-align: middle; }
.mchd-journey { list-style: none; counter-reset: j; margin: 0; padding: 0; display: grid; gap: 2px; }
.mchd-journey li { counter-increment: j; display: flex; flex-direction: column; padding: 6px 8px 6px 30px; position: relative; border-radius: 6px; }
.mchd-journey li::before { content: counter(j); position: absolute; left: 6px; top: 7px; width: 18px; height: 18px; border-radius: 50%; background: var(--mchd-surface-2); border: 1px solid var(--mchd-border); font-size: 11px; display: grid; place-items: center; color: var(--mchd-muted); }
.mchd-journey li.is-seekable { cursor: pointer; }
.mchd-journey li.is-seekable:hover { background: var(--mchd-surface-2); }
.mchd-layout-player { grid-template-columns: minmax(0, 1fr) 300px; }
.mchd-player-panel { padding: 12px; overflow: auto; }
.mchd-player-panel .rr-player { box-shadow: none !important; margin: 0 auto; }
.mchd-back { display: inline-block; margin-bottom: 10px; font-size: .9em; }

/* Chat inbox ------------------------------------------------------------ */
.mchd-chat-app { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: min(78vh, 760px); min-height: 480px; background: var(--mchd-surface); border: 1px solid var(--mchd-border); border-radius: var(--mchd-radius); box-shadow: var(--mchd-shadow); overflow: hidden; margin-bottom: 12px; }
.mchd-chat-list { border-right: 1px solid var(--mchd-border); display: flex; flex-direction: column; min-height: 0; }
.mchd-chat-list-head { padding: 12px 14px; border-bottom: 1px solid var(--mchd-border); display: flex; flex-direction: column; gap: 4px; }
.mchd-chat-items { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.mchd-chat-item { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--mchd-border); padding: 11px 14px; cursor: pointer; color: var(--mchd-text); font: inherit; }
.mchd-chat-item:hover { background: var(--mchd-surface-2); }
.mchd-chat-item.is-current { background: color-mix(in srgb, var(--mchd-accent) 10%, transparent); box-shadow: inset 3px 0 0 var(--mchd-accent); }
.mchd-chat-item.is-waiting { background: color-mix(in srgb, var(--mchd-warning) 10%, transparent); }
.mchd-chat-item.is-closed { opacity: .65; }
.mchd-chat-item-top { display: flex; justify-content: space-between; gap: 8px; }
.mchd-chat-item-top time { color: var(--mchd-muted); font-size: .8em; }
.mchd-chat-item-last { color: var(--mchd-muted); font-size: .85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mchd-chat-item-meta { display: flex; align-items: center; gap: 6px; font-size: .8em; }
.mchd-chat-main { display: grid; grid-template-columns: minmax(0, 1fr) 250px; min-height: 0; }
.mchd-chat-main > .mchd-empty { grid-column: 1 / -1; align-self: center; }
.mchd-chat-conv { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--mchd-border); }
.mchd-chat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--mchd-border); flex-wrap: wrap; }
.mchd-chat-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mchd-chat-thread { flex: 1; overflow-y: auto; padding: 16px; background: var(--mchd-surface-2); display: flex; flex-direction: column; gap: 8px; }
.mchd-cmsg { max-width: 75%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; position: relative; }
.mchd-cmsg time { display: block; font-size: .7em; opacity: .7; margin-top: 2px; }
.mchd-cmsg small { display: block; font-size: .75em; opacity: .8; }
.mchd-cmsg-visitor { align-self: flex-start; background: var(--mchd-surface); border: 1px solid var(--mchd-border); border-bottom-left-radius: 4px; }
.mchd-cmsg-agent { align-self: flex-end; background: var(--mchd-accent); color: #fff; border-bottom-right-radius: 4px; }
.mchd-cmsg-system { align-self: center; color: var(--mchd-muted); font-size: .82em; text-align: center; background: none; }
.mchd-chat-compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--mchd-border); }
.mchd-chat-compose[hidden] { display: none; }
.mchd-chat-compose textarea { flex: 1; resize: none; }
.mchd-chat-info { padding: 14px; overflow-y: auto; font-size: .92em; }
.mchd-chat-info .mchd-dl { grid-template-columns: 1fr; gap: 2px; }
.mchd-chat-info .mchd-dl dd { margin-bottom: 8px; }
.mchd-chat-info h4 { margin: 12px 0 6px; font-size: .9em; }
.mchd-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: .92em; }
.mchd-switch input { position: absolute; opacity: 0; }
.mchd-switch-ui { width: 36px; height: 20px; border-radius: 10px; background: #cbd5e1; position: relative; transition: background .15s; flex: none; }
.mchd-switch-ui::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.mchd-switch input:checked + .mchd-switch-ui { background: var(--mchd-success); }
.mchd-switch input:checked + .mchd-switch-ui::after { transform: translateX(16px); }
.mchd-switch input:focus-visible + .mchd-switch-ui { outline: 2px solid var(--mchd-accent); outline-offset: 2px; }

@media (max-width: 1000px) {
	.mchd-chat-main { grid-template-columns: 1fr; }
	.mchd-chat-info { display: none; }
	.mchd-layout-player { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
	.mchd-chat-app { grid-template-columns: 1fr; height: auto; }
	.mchd-chat-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--mchd-border); }
	.mchd-chat-conv { min-height: 420px; }
}

/* ---------------------------------------------------------------------------
 * Spam folder, rules, SLA and autoresponder (2.2)
 * ------------------------------------------------------------------------ */
.mchd-status-spam { background: #fee2e2; color: #b91c1c; border-color: transparent; }
.mchd-badge-spam { background: #fee2e2; color: #b91c1c; }
.mchd-count-danger { background: var(--mchd-danger); }
.mchd-tabs .mchd-tab-spam { margin-left: auto; }
.mchd-bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.mchd-bulkbar .mchd-link-danger { margin-left: auto; }
.mchd-spam-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mchd-spam-item { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; margin: 0 !important; }
.mchd-spam-pick { padding-top: 2px; }
.mchd-spam-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mchd-spam-subject { font-weight: 600; margin: 4px 0 2px; }
.mchd-spam-excerpt { margin: 0 0 6px; color: var(--mchd-muted); overflow-wrap: anywhere; }
.mchd-spam-actions { display: flex; flex-direction: column; gap: 6px; }
.mchd-spam-banner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.mchd-spam-banner ul { margin: 6px 0 0; }
.mchd-inline-actions { display: flex; gap: 8px; margin: 0; }
.mchd-spam-mark .mchd-check { display: block; margin-top: 8px; }
.mchd-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mchd-rules code { overflow-wrap: anywhere; }
.mchd-input-sm { width: 90px !important; display: inline-block !important; }
.mchd-align-end { align-self: end; }
.mchd-hours input[type=time] { width: auto; padding: 5px 8px; }
.mchd-hours td, .mchd-sla-targets td { padding: 8px 12px; }
.mchd-actions-row { display: flex; flex-wrap: wrap; gap: 10px; }
.mchd-placeholders { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.mchd-ph { background: none; border: 1px solid var(--mchd-border); border-radius: 6px; padding: 1px 6px; cursor: pointer; }
.mchd-ph:hover { border-color: var(--mchd-accent); }
.mchd-mail-preview { border: 1px solid var(--mchd-border); border-radius: var(--mchd-radius); background: var(--mchd-surface-2); padding: 14px 16px; margin-bottom: 12px; }
.mchd-mail-subject { font-weight: 700; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--mchd-border); }
.mchd-mail-body p { margin: 0 0 10px; }
.mchd-sla { display: inline-block; margin-top: 3px; padding: 1px 8px; border-radius: 999px; font-size: .75em; font-weight: 600; white-space: nowrap; background: #f1f5f9; color: #475569; }
.mchd-sla-ok { background: #e0f2fe; color: #0369a1; }
.mchd-sla-soon { background: #fef3c7; color: #b45309; }
.mchd-sla-overdue, .mchd-sla-missed { background: #fee2e2; color: #b91c1c; }
.mchd-sla-met { background: #dcfce7; color: #15803d; }
.mchd-sla-paused { background: #f1f5f9; color: #475569; }
.mchd-stat-danger .mchd-stat-value { color: var(--mchd-danger); }
@media (max-width: 700px) {
	.mchd-row-3 { grid-template-columns: 1fr; }
	.mchd-spam-item { grid-template-columns: auto 1fr; }
	.mchd-spam-actions { grid-column: 1 / -1; flex-direction: row; }
}
.mchd-bulkbar-tickets { padding: 8px 12px; background: var(--mchd-surface); border: 1px solid var(--mchd-border); border-radius: var(--mchd-radius); }
.mchd-col-pick { width: 36px; padding-right: 0 !important; }
.mchd-table tbody tr.is-selected td { background: color-mix(in srgb, var(--mchd-accent) 7%, transparent); }
.mchd-edited { font-style: italic; }
.mchd-edit-reply { margin-top: 8px; }
.mchd-edit-reply summary { cursor: pointer; color: var(--mchd-muted); font-size: .85em; display: inline-block; }
.mchd-notify-list { display: grid; gap: 10px; }
.mchd-notify-item > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.mchd-notify-item > summary::-webkit-details-marker { display: none; }
.mchd-notify-item > summary .mchd-notify-title { font-weight: 600; flex: 1; }
.mchd-notify-item[open] > summary { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--mchd-border); }
.mchd-notify-off { opacity: .6; }
.mchd-notify-summary { display: flex; align-items: center; gap: 10px; }
.mchd-notify-summary .mchd-notify-title { font-weight: 600; flex: 1; }
