:root {
    --ehd-primary: #1769ff;
    --ehd-secondary: #64748b;
    --ehd-text: #111827;
    --ehd-heading: #0f172a;
    --ehd-bg: #eaf4ff;
    --ehd-panel: #ffffff;
    --ehd-table-heading: #1769ff;
    --ehd-font-size: 16px;
    --ehd-border: #dbe5f1;
    --ehd-soft: #f6f9fd;
    --ehd-shadow: 0 18px 48px rgba(15, 23, 42, .12);
    --ehd-shadow-soft: 0 10px 30px rgba(15, 23, 42, .08);
}

.ehd-app, .ehd-modal {
    color: var(--ehd-text);
    font-size: var(--ehd-font-size);
    line-height: 1.55;
    box-sizing: border-box;
}
.ehd-app *, .ehd-modal * { box-sizing: border-box; }
.ehd-app { max-width: 1380px; margin: 0 auto; padding: 24px; }
.ehd-app h2, .ehd-app h3, .ehd-modal h2, .ehd-modal h3 { color: var(--ehd-heading); }
.ehd-kicker { display: inline-flex; color: var(--ehd-primary); font-size: 12px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.ehd-hero-card {
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    padding: 32px;
    border-radius: 24px;
    color: #fff;
    background: radial-gradient(circle at 90% 15%, rgba(255,255,255,.2), transparent 25%), linear-gradient(135deg, #0f172a, var(--ehd-primary));
    box-shadow: var(--ehd-shadow);
}
.ehd-hero-card::after { content: ""; position: absolute; right: -50px; bottom: -70px; width: 220px; height: 220px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; }
.ehd-hero-card .ehd-kicker { color: #bfdbfe; }
.ehd-hero-card h2 { margin: 8px 0 8px; color: #fff; font-size: clamp(28px, 4vw, 46px); line-height: 1.12; }
.ehd-hero-card p { max-width: 800px; margin: 0; color: #dbeafe; }
.ehd-3d-card { background: var(--ehd-panel); border: 1px solid rgba(219,229,241,.95); border-radius: 22px; box-shadow: var(--ehd-shadow-soft); transition: transform .25s ease, box-shadow .25s ease; }
.ehd-3d-card:hover { transform: perspective(1100px) translateY(-3px) rotateX(.4deg); box-shadow: var(--ehd-shadow); }

/* Forms */
.ehd-ticket-form { margin-bottom: 28px; padding: 28px; }
.ehd-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.ehd-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; font-weight: 800; }
.ehd-field--full { grid-column: 1 / -1; }
.ehd-field > span, .ehd-field-title { color: #1e293b; font-size: .92em; }
.ehd-field b { color: #dc2626; }
.ehd-field input:not([type="file"]), .ehd-field select, .ehd-field textarea,
.ehd-reply-form textarea, .ehd-control-label select, .ehd-filter-bar input, .ehd-filter-bar select,
.ehd-bulk-toolbar select {
    width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid #cbd5e1; border-radius: 11px;
    background: #fff; color: var(--ehd-text); font: inherit; outline: none; transition: border-color .2s, box-shadow .2s;
}
.ehd-field textarea, .ehd-reply-form textarea { min-height: 128px; resize: vertical; }
.ehd-field input:focus, .ehd-field select:focus, .ehd-field textarea:focus, .ehd-reply-form textarea:focus,
.ehd-filter-bar input:focus, .ehd-filter-bar select:focus, .ehd-control-label select:focus {
    border-color: var(--ehd-primary); box-shadow: 0 0 0 4px rgba(23,105,255,.12);
}
.ehd-field small { color: var(--ehd-secondary); font-weight: 500; }
.ehd-honeypot { position: absolute !important; left: -9999px !important; opacity: 0 !important; }
.ehd-button, .ehd-secondary-button, .ehd-action-button, .ehd-text-button {
    appearance: none; border: 0; font: inherit; cursor: pointer; text-decoration: none; transition: transform .2s, filter .2s, box-shadow .2s;
}
.ehd-button { display: inline-flex; align-items: center; justify-content: center; min-height: 45px; margin-top: 18px; padding: 11px 20px; border-radius: 11px; background: linear-gradient(135deg, var(--ehd-primary), #0d4fc9); color: #fff !important; font-weight: 900; box-shadow: 0 10px 22px rgba(23,105,255,.22); }
.ehd-button:hover { transform: translateY(-2px); filter: brightness(1.05); }
.ehd-button:disabled { opacity: .62; cursor: wait; transform: none; }
.ehd-button--full { width: 100%; }
.ehd-secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 8px 13px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: #334155; font-weight: 800; }
.ehd-secondary-button:hover { border-color: var(--ehd-primary); color: var(--ehd-primary); transform: translateY(-1px); }
.ehd-secondary-button--danger { color: #b91c1c; border-color: #fecaca; }
.ehd-text-button { padding: 4px 7px; background: transparent; color: var(--ehd-primary); font-size: 12px; font-weight: 900; }
.ehd-form-notice, .ehd-admin-notice { margin-top: 14px; border-radius: 12px; }
.ehd-form-notice.is-success, .ehd-admin-notice.is-success { padding: 12px; background: #ecfdf5; color: #065f46; }
.ehd-form-notice.is-error, .ehd-admin-notice.is-error, .ehd-notice.is-error { padding: 12px; background: #fef2f2; color: #991b1b; }
.ehd-form-notice--submitted { padding: 0 !important; background: transparent !important; }

/* Staff checkbox directory */
.ehd-staff-field { display: block; }
.ehd-staff-placeholder, .ehd-staff-empty { padding: 22px; border: 1px dashed #bfdbfe; border-radius: 14px; background: #f8fbff; color: #64748b; text-align: center; }
.ehd-staff-picker { overflow: hidden; border: 1px solid var(--ehd-border); border-radius: 16px; background: #fff; }
.ehd-staff-picker__toolbar { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; gap: 8px; align-items: center; padding: 12px; border-bottom: 1px solid var(--ehd-border); background: #f8fafc; }
.ehd-staff-search-wrap input { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; }
.ehd-staff-checkboxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-height: 330px; overflow: auto; padding: 12px; }
.ehd-staff-option { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr) 22px; gap: 10px; align-items: center; min-width: 0; padding: 11px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; cursor: pointer; transition: .2s; }
.ehd-staff-option:hover { border-color: #93c5fd; transform: translateY(-1px); box-shadow: 0 7px 16px rgba(15,23,42,.07); }
.ehd-staff-option:has(input:checked) { border-color: var(--ehd-primary); background: #eff6ff; box-shadow: inset 0 0 0 1px var(--ehd-primary); }
.ehd-staff-option input { position: absolute; opacity: 0; pointer-events: none; }
.ehd-staff-avatar, .ehd-message__avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1d4ed8; font-size: 12px; font-weight: 900; }
.ehd-staff-name { display: flex; min-width: 0; flex-direction: column; }
.ehd-staff-name strong { overflow: hidden; color: #172033; text-overflow: ellipsis; white-space: nowrap; }
.ehd-staff-name small { overflow: hidden; color: #64748b; font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.ehd-checkmark { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: 1px solid #cbd5e1; border-radius: 6px; color: transparent; font-size: 12px; }
.ehd-staff-option:has(input:checked) .ehd-checkmark { border-color: var(--ehd-primary); background: var(--ehd-primary); color: #fff; }
.ehd-staff-picker__count { padding: 9px 13px; border-top: 1px solid var(--ehd-border); background: #f8fafc; color: #64748b; font-size: 12px; text-align: right; }
.ehd-staff-picker--compact .ehd-staff-checkboxes { grid-template-columns: 1fr; max-height: 245px; }
.ehd-staff-picker--compact .ehd-staff-picker__toolbar { grid-template-columns: 1fr; }
.ehd-staff-picker--compact .ehd-text-button { display: none; }

/* Submitted templates */
.ehd-submitted-card { display: flex; align-items: flex-start; gap: 16px; padding: 22px; border-radius: 17px; color: #0f172a; text-align: left; }
.ehd-submitted-icon { display: flex; align-items: center; justify-content: center; flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; background: #16a34a; color: #fff; font-size: 24px; font-weight: 900; }
.ehd-submitted-card span { color: #15803d; font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.ehd-submitted-card h3 { margin: 3px 0; }
.ehd-submitted-card p { margin: 3px 0 12px; color: #475569; }
.ehd-ticket-success-link { display: inline-flex; padding: 8px 13px; border-radius: 9px; background: var(--ehd-primary); color: #fff !important; font-weight: 900; text-decoration: none; }
.ehd-submitted-template-1 { border: 1px solid #bbf7d0; background: linear-gradient(135deg, #ecfdf5, #f0fdf4); }
.ehd-submitted-template-2 { border-left: 6px solid #16a34a; background: #fff; box-shadow: var(--ehd-shadow-soft); }
.ehd-submitted-template-3 { border: 1px solid #d1d5db; border-radius: 6px; background: #fff; }
.ehd-submitted-template-4 { color: #fff; background: linear-gradient(135deg, #166534, #16a34a); }
.ehd-submitted-template-4 h3, .ehd-submitted-template-4 span, .ehd-submitted-template-4 p { color: #fff; }
.ehd-submitted-template-5 { border: 2px dashed #86efac; background: transparent; }

/* Lists and five list templates */
.ehd-two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.ehd-list-card { overflow: hidden; padding: 22px; }
.ehd-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.ehd-list-heading h3 { margin: 0; }
.ehd-list-heading > span { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; border-radius: 50%; background: #dbeafe; color: #1d4ed8; font-weight: 900; }
.ehd-ticket-list { display: flex; flex-direction: column; gap: 10px; }
.ehd-ticket-list__item { width: 100%; display: flex; justify-content: space-between; gap: 16px; text-align: left; border: 1px solid #e2e8f0; background: #fff; border-radius: 13px; padding: 14px; cursor: pointer; color: var(--ehd-text); transition: .2s; }
.ehd-ticket-list__item:hover { border-color: var(--ehd-primary); transform: translateX(3px); box-shadow: 0 8px 18px rgba(15,23,42,.07); }
.ehd-list-ticket-main, .ehd-list-ticket-side { display: flex; flex-direction: column; gap: 3px; }
.ehd-list-ticket-main { min-width: 0; }
.ehd-list-ticket-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ehd-list-ticket-main strong { color: var(--ehd-primary); font-size: 11px; letter-spacing: .06em; }
.ehd-list-ticket-side { align-items: flex-end; text-align: right; }
.ehd-ticket-list__item small, .ehd-empty { color: var(--ehd-secondary); }
.ehd-list-template-2 { background: linear-gradient(145deg, #eff6ff, #fff); }
.ehd-list-template-2 .ehd-ticket-list__item { border: 0; box-shadow: 0 8px 20px rgba(23,105,255,.09); }
.ehd-list-template-3 { border-radius: 8px; }
.ehd-list-template-3 .ehd-ticket-list__item { border-width: 0 0 1px; border-radius: 0; padding-left: 4px; padding-right: 4px; }
.ehd-list-template-4 { background: linear-gradient(145deg, #0f172a, #1e3a8a); }
.ehd-list-template-4 h3 { color: #fff; }
.ehd-list-template-4 .ehd-ticket-list__item { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.09); color: #fff; }
.ehd-list-template-4 .ehd-ticket-list__item small, .ehd-list-template-4 .ehd-list-ticket-main strong { color: #bfdbfe; }
.ehd-list-template-5 { border: 2px solid #dbeafe; box-shadow: none; }
.ehd-list-template-5 .ehd-ticket-list__item { border: 1px dashed #94a3b8; }

/* Status and priority */
.ehd-status, .ehd-priority { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 5px 10px; font-size: 11px; font-style: normal; font-weight: 900; text-transform: capitalize; }
.ehd-status--open { background: #dbeafe; color: #1d4ed8; }
.ehd-status--pending { background: #fef3c7; color: #92400e; }
.ehd-status--resolved { background: #d1fae5; color: #065f46; }
.ehd-status--closed { background: #e5e7eb; color: #374151; }
.ehd-status--trash { background: #fee2e2; color: #991b1b; }
.ehd-priority--high { background: #fee2e2; color: #991b1b; }
.ehd-priority--medium { background: #fef3c7; color: #92400e; }
.ehd-priority--low { background: #e0f2fe; color: #075985; }

/* Redesigned ticket modal and open view */
.ehd-modal[hidden] { display: none; }
.ehd-modal { position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center; padding: 18px; }
.ehd-modal__backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, .78); backdrop-filter: blur(8px); }
.ehd-modal__dialog { position: relative; width: min(1240px, 100%); max-height: 95vh; overflow: hidden; border: 1px solid rgba(255,255,255,.25); border-radius: 24px; background: #f4f7fb; box-shadow: 0 35px 100px rgba(0,0,0,.45); animation: ehd-pop .22s ease; }
.ehd-modal__topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 8px 14px 8px 20px; border-bottom: 1px solid #dbe5f1; background: rgba(255,255,255,.96); color: #475569; font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; backdrop-filter: blur(10px); }
.ehd-modal__close { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; border-radius: 11px; background: #0f172a; color: #fff; font-size: 25px; cursor: pointer; }
.ehd-modal__content { max-height: calc(95vh - 52px); overflow: auto; }
.ehd-modal-open { overflow: hidden; }
@keyframes ehd-pop { from { opacity: 0; transform: translateY(22px) scale(.975); } to { opacity: 1; transform: none; } }
.ehd-auto-ticket { max-width: 1240px; margin: auto; border-radius: 24px; background: #f4f7fb; box-shadow: var(--ehd-shadow); }
.ehd-ticket-detail { overflow: hidden; background: #f4f7fb; }
.ehd-ticket-banner { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 27px 30px; border-bottom: 1px solid #dbe5f1; background: #fff; }
.ehd-ticket-banner__identity { display: flex; align-items: flex-start; gap: 16px; min-width: 0; }
.ehd-ticket-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 52px; width: 52px; height: 52px; border-radius: 16px; background: linear-gradient(135deg, var(--ehd-primary), #0d4fc9); color: #fff; font-size: 25px; font-weight: 900; box-shadow: 0 12px 24px rgba(23,105,255,.24); }
.ehd-ticket-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; color: var(--ehd-primary); font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.ehd-ticket-banner h2 { margin: 5px 0 4px; font-size: clamp(23px, 3vw, 34px); line-height: 1.15; }
.ehd-ticket-banner p { margin: 0; color: #64748b; font-size: 13px; }
.ehd-ticket-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.ehd-ticket-main { min-width: 0; padding: 24px; }
.ehd-ticket-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; gap: 15px; padding: 24px 24px 24px 0; }
.ehd-conversation-panel, .ehd-sidebar-card, .ehd-reply-form { border: 1px solid #dbe5f1; border-radius: 18px; background: #fff; box-shadow: 0 8px 24px rgba(15,23,42,.06); }
.ehd-conversation-panel { overflow: hidden; }
.ehd-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid #e5edf6; }
.ehd-section-heading h3 { margin: 2px 0 0; }
.ehd-message-count { padding: 5px 9px; border-radius: 999px; background: #f1f5f9; color: #64748b; font-size: 11px; font-weight: 800; }
.ehd-conversation { display: flex; flex-direction: column; gap: 18px; padding: 20px; background: linear-gradient(180deg, #f8fafc, #f3f7fb); }
.ehd-message { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 11px; max-width: 88%; }
.ehd-message--staff { align-self: flex-end; grid-template-columns: minmax(0, 1fr) 42px; }
.ehd-message--staff .ehd-message__avatar { grid-column: 2; grid-row: 1; background: linear-gradient(135deg, var(--ehd-primary), #0d4fc9); color: #fff; }
.ehd-message--staff .ehd-message__content { grid-column: 1; grid-row: 1; border-color: #bfdbfe; background: #eff6ff; }
.ehd-message__content { min-width: 0; padding: 14px 15px; border: 1px solid #e2e8f0; border-radius: 4px 16px 16px 16px; background: #fff; box-shadow: 0 5px 14px rgba(15,23,42,.05); }
.ehd-message--staff .ehd-message__content { border-radius: 16px 4px 16px 16px; }
.ehd-message__content header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 9px; }
.ehd-message__content header > div { display: flex; flex-direction: column; }
.ehd-message__content header span { color: #64748b; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.ehd-message__content time { color: #94a3b8; font-size: 11px; white-space: nowrap; }
.ehd-message__body { color: #334155; overflow-wrap: anywhere; }
.ehd-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ehd-attachments a { display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px; border: 1px solid #bfdbfe; border-radius: 9px; background: #fff; color: #1d4ed8; font-size: 12px; font-weight: 800; text-decoration: none; }
.ehd-reply-form { margin-top: 18px; padding: 18px; }
.ehd-composer-heading { display: flex; justify-content: space-between; margin-bottom: 10px; }
.ehd-composer-heading > div { display: flex; flex-direction: column; }
.ehd-composer-heading small { color: #64748b; }
.ehd-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.ehd-composer-actions .ehd-button { margin-top: 10px; }
.ehd-file-label { display: inline-flex; cursor: pointer; }
.ehd-file-label span { display: inline-flex; margin-top: 10px; padding: 9px 12px; border: 1px dashed #94a3b8; border-radius: 10px; color: #475569; font-size: 12px; font-weight: 800; }
.ehd-file-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ehd-sidebar-card { padding: 18px; }
.ehd-sidebar-card > h3 { margin: 0 0 12px; font-size: 16px; }
.ehd-detail-list { margin: 0; }
.ehd-detail-list > div { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf2f7; }
.ehd-detail-list > div:last-child { border-bottom: 0; }
.ehd-detail-list dt { color: #64748b; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.ehd-detail-list dd { margin: 0; color: #1e293b; font-weight: 800; overflow-wrap: anywhere; }
.ehd-detail-list dd small { display: block; color: #64748b; font-size: 11px; font-weight: 500; }
.ehd-management-card .ehd-section-heading { margin: -18px -18px 15px; padding: 15px 18px; }
.ehd-control-label { display: flex; flex-direction: column; gap: 7px; margin-bottom: 13px; color: #334155; font-size: 12px; font-weight: 900; }
.ehd-danger-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #fee2e2; }
.ehd-action-button { padding: 9px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: #334155; font-size: 12px; font-weight: 900; }
.ehd-action-button--danger { border-color: #fecaca; color: #b91c1c; }
.ehd-notice { max-width: 1100px; margin: 18px auto; padding: 17px; border-left: 5px solid var(--ehd-primary); border-radius: 12px; background: #fff; box-shadow: var(--ehd-shadow-soft); }
.ehd-loader { padding: 34px; color: var(--ehd-secondary); text-align: center; }

/* Five open ticket templates */
.ehd-open-template-2 .ehd-ticket-banner { background: linear-gradient(135deg, #eff6ff, #fff); }
.ehd-open-template-2 .ehd-conversation-panel, .ehd-open-template-2 .ehd-sidebar-card, .ehd-open-template-2 .ehd-reply-form { border: 0; border-radius: 25px; box-shadow: 0 15px 35px rgba(23,105,255,.1); }
.ehd-open-template-3 .ehd-ticket-banner, .ehd-open-template-3 .ehd-ticket-main, .ehd-open-template-3 .ehd-ticket-sidebar { padding-top: 16px; padding-bottom: 16px; }
.ehd-open-template-3 .ehd-conversation-panel, .ehd-open-template-3 .ehd-sidebar-card, .ehd-open-template-3 .ehd-reply-form { border-radius: 7px; box-shadow: none; }
.ehd-open-template-3 .ehd-message__content { border-radius: 6px; }
.ehd-open-template-4 .ehd-ticket-banner { color: #fff; background: linear-gradient(135deg, #0f172a, #1d4ed8); }
.ehd-open-template-4 .ehd-ticket-banner h2, .ehd-open-template-4 .ehd-ticket-banner p, .ehd-open-template-4 .ehd-ticket-eyebrow { color: #fff; }
.ehd-open-template-4 .ehd-ticket-workspace { background: linear-gradient(145deg, #eff6ff, #f8fafc); }
.ehd-open-template-5 .ehd-ticket-banner { border: 2px solid #0f172a; border-width: 0 0 2px; background: #fff; }
.ehd-open-template-5 .ehd-conversation-panel, .ehd-open-template-5 .ehd-sidebar-card, .ehd-open-template-5 .ehd-reply-form { border: 2px solid #cbd5e1; box-shadow: none; }

/* Filters */
.ehd-filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, auto)) auto; gap: 10px; align-items: center; margin: 0 0 16px; padding: 13px; border: 1px solid #dbe5f1; border-radius: 15px; background: #fff; box-shadow: 0 7px 20px rgba(15,23,42,.05); }
.ehd-list-card .ehd-filter-bar { grid-template-columns: 1fr 130px 130px auto; padding: 9px; box-shadow: none; }
.ehd-filter-bar input, .ehd-filter-bar select { min-height: 42px; padding: 8px 10px; }
.ehd-filter-empty, .ehd-empty-panel { padding: 28px; border: 1px dashed #cbd5e1; border-radius: 15px; background: #fff; color: #64748b; text-align: center; }

/* Department/admin queue */
.ehd-queue-app { max-width: 1500px; }
.ehd-bulk-toolbar { display: grid; grid-template-columns: auto 180px 190px minmax(220px, 1fr) auto; gap: 10px; align-items: center; margin-bottom: 18px; padding: 14px; border: 1px solid #dbe5f1; border-radius: 16px; background: #fff; box-shadow: var(--ehd-shadow-soft); }
.ehd-check-all-wrap { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-weight: 800; }
.ehd-bulk-toolbar .ehd-button { margin: 0; }
.ehd-bulk-toolbar .ehd-form-notice { grid-column: 1 / -1; margin: 0; }
.ehd-bulk-staff-container { min-width: 0; color: #64748b; font-size: 12px; }
.ehd-bulk-staff-container .ehd-staff-picker { position: relative; }
.ehd-bulk-staff-container .ehd-staff-checkboxes { grid-template-columns: repeat(2, minmax(0,1fr)); max-height: 190px; }
.ehd-queue-list { display: flex; flex-direction: column; gap: 20px; }
.ehd-queue-ticket { border-radius: 18px; box-shadow: var(--ehd-shadow-soft); }
.ehd-conversation-table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1px solid #cfdbea; border-radius: 18px; background: #fff; }
.ehd-conversation-table thead th { padding: 14px 16px; background: linear-gradient(135deg, var(--ehd-table-heading), #0d4fc9); color: #fff; text-align: left; }
.ehd-conversation-table thead th:first-child { border-radius: 17px 0 0 0; }
.ehd-conversation-table thead th:last-child { border-radius: 0 17px 0 0; }
.ehd-queue-check { width: 44px; text-align: center !important; }
.ehd-queue-status { width: 110px; text-align: right !important; }
.ehd-queue-number { display: inline-flex; margin-right: 6px; color: #bfdbfe; }
.ehd-conversation-table tbody td { padding: 13px 16px; border-top: 1px solid #e5edf6; vertical-align: top; }
.ehd-queue-summary-row td:not(:first-child) { width: 33%; }
.ehd-queue-summary-row td > strong { display: block; margin-bottom: 4px; color: #64748b; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.ehd-queue-summary-row td > span:not(.ehd-priority) { display: block; color: #1e293b; font-weight: 800; }
.ehd-queue-summary-row small { display: block; margin-top: 3px; color: #64748b; }
.ehd-queue-thread-cell { background: #f8fafc; }
.ehd-queue-thread { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow: auto; padding: 4px; }
.ehd-queue-message { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 9px; max-width: 88%; padding: 11px; border: 1px solid #e2e8f0; border-radius: 13px; background: #fff; }
.ehd-queue-message--staff { align-self: flex-end; border-color: #bfdbfe; background: #eff6ff; }
.ehd-queue-message .ehd-staff-avatar { width: 38px; height: 38px; }
.ehd-queue-message header { display: flex; justify-content: space-between; gap: 12px; }
.ehd-queue-message time { color: #94a3b8; font-size: 10px; }
.ehd-queue-message p { margin: 5px 0 0; color: #475569; }

.ehd-queue-attachments { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.ehd-queue-attachments a { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border: 1px solid #bfdbfe; border-radius: 9px; background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 800; text-decoration: none; }
.ehd-queue-attachments a:hover { background: #dbeafe; }
.ehd-queue-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 13px; border-top: 1px solid #dbe5f1; }
.ehd-queue-actions .ehd-button { min-height: 39px; margin: 0; padding: 8px 13px; }

@media (max-width: 1100px) {
    .ehd-ticket-workspace { grid-template-columns: 1fr; }
    .ehd-ticket-sidebar { position: static; padding: 0 24px 24px; }
    .ehd-staff-checkboxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ehd-bulk-toolbar { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .ehd-bulk-toolbar .ehd-button, .ehd-bulk-staff-container { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
    .ehd-app { padding: 14px; }
    .ehd-form-grid, .ehd-two-column { grid-template-columns: 1fr; }
    .ehd-filter-bar, .ehd-list-card .ehd-filter-bar { grid-template-columns: 1fr 1fr; }
    .ehd-filter-search { grid-column: 1 / -1; }
    .ehd-staff-checkboxes { grid-template-columns: 1fr; }
    .ehd-modal { padding: 5px; }
    .ehd-modal__dialog { max-height: 98vh; border-radius: 15px; }
    .ehd-modal__content { max-height: calc(98vh - 52px); }
    .ehd-ticket-banner { flex-direction: column; padding: 21px; }
    .ehd-ticket-main { padding: 14px; }
    .ehd-ticket-sidebar { padding: 0 14px 14px; }
    .ehd-message { max-width: 100%; }
    .ehd-message__content header { flex-direction: column; gap: 3px; }
    .ehd-composer-actions { align-items: stretch; flex-direction: column; }
    .ehd-danger-actions { grid-template-columns: 1fr; }
    .ehd-conversation-table, .ehd-conversation-table tbody, .ehd-conversation-table tr, .ehd-conversation-table td { display: block; width: 100% !important; }
    .ehd-conversation-table thead { display: table; width: 100%; }
    .ehd-conversation-table thead tr { display: table-row; }
    .ehd-conversation-table thead th { display: table-cell; }
    .ehd-queue-summary-row td:first-child, .ehd-conversation-table tbody tr:last-child td:first-child { display: none; }
    .ehd-queue-message { max-width: 100%; }
}
@media (max-width: 520px) {
    .ehd-filter-bar, .ehd-list-card .ehd-filter-bar, .ehd-bulk-toolbar { grid-template-columns: 1fr; }
    .ehd-filter-search, .ehd-bulk-toolbar .ehd-button, .ehd-bulk-staff-container { grid-column: auto; }
    .ehd-ticket-list__item { flex-direction: column; }
    .ehd-list-ticket-side { align-items: flex-start; text-align: left; }
    .ehd-ticket-banner__identity { flex-direction: column; }
    .ehd-detail-list > div { grid-template-columns: 1fr; gap: 3px; }
    .ehd-staff-picker__toolbar { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .ehd-3d-card, .ehd-button, .ehd-ticket-list__item, .ehd-modal__dialog, .ehd-staff-option { transition: none !important; animation: none !important; transform: none !important; }
}

/* Version 1.2 professional design system */
.ehd-app {
    max-width: var(--ehd-page-max-width, 1380px);
    padding: var(--ehd-page-padding, 24px);
    background: transparent;
}
.ehd-app h2 { font-size: var(--ehd-heading-size, 30px); }
.ehd-app h3, .ehd-modal h3 { font-size: var(--ehd-section-heading-size, 20px); }
.ehd-hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 0;
    padding: var(--ehd-hero-padding, 28px);
    border-radius: var(--ehd-hero-radius, 20px);
    background: radial-gradient(circle at 94% 10%, rgba(255,255,255,.2), transparent 27%), linear-gradient(135deg, var(--ehd-hero-start, #0f172a), var(--ehd-hero-end, #1769ff));
    color: var(--ehd-hero-text, #fff);
}
.ehd-hero-copy { position: relative; z-index: 2; min-width: 0; }
.ehd-hero-card .ehd-kicker { color: var(--ehd-hero-description, #dbeafe); font-size: var(--ehd-hero-kicker-size, 11px); }
.ehd-hero-card h2 { margin: 5px 0 5px; color: var(--ehd-hero-text, #fff); font-size: clamp(24px, 4vw, var(--ehd-hero-heading-size, 34px)); }
.ehd-hero-card p { max-width: 660px; color: var(--ehd-hero-description, #dbeafe); font-size: var(--ehd-hero-description-size, 15px); }
.ehd-3d-card, .ehd-list-card, .ehd-ticket-form, .ehd-sidebar-card, .ehd-conversation-panel, .ehd-reply-form { border-radius: var(--ehd-card-radius, 18px); }
.ehd-field input:not([type="file"]), .ehd-field select, .ehd-field textarea, .ehd-reply-form textarea, .ehd-control-label select, .ehd-filter-bar input, .ehd-filter-bar select, .ehd-bulk-toolbar select { border-color: var(--ehd-border, #dbe5f1); border-radius: var(--ehd-input-radius, 11px); }
.ehd-button, .ehd-secondary-button, .ehd-action-button, .ehd-table-open { border-radius: var(--ehd-button-radius, 11px); }
.ehd-modal__dialog { width: min(calc(100vw - 28px), var(--ehd-modal-width, 1240px)); max-width: var(--ehd-modal-width, 1240px); }

/* Notifications */
.ehd-notifications { position: relative; z-index: 5; flex: 0 0 auto; }
.ehd-notification-button {
    display: inline-flex; align-items: center; gap: 8px; min-height: 43px; padding: 8px 11px;
    border: 1px solid rgba(255,255,255,.28); border-radius: 999px; background: rgba(255,255,255,.12);
    color: #fff; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; backdrop-filter: blur(8px);
}
.ehd-notification-button:hover, .ehd-notification-button[aria-expanded="true"] { background: rgba(255,255,255,.22); }
.ehd-notification-button b { display: inline-flex; align-items: center; justify-content: center; min-width: 23px; height: 23px; padding: 0 6px; border-radius: 999px; background: #fff; color: var(--ehd-primary); font-size: 11px; }
.ehd-notification-menu { position: absolute; top: calc(100% + 9px); right: 0; width: min(310px, calc(100vw - 36px)); overflow: hidden; border: 1px solid var(--ehd-border); border-radius: 14px; background: #fff; color: var(--ehd-text); box-shadow: 0 18px 45px rgba(15,23,42,.2); }
.ehd-notification-menu a { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 15px; border-bottom: 1px solid #edf2f7; color: #1e293b; text-decoration: none; font-size: 13px; font-weight: 700; }
.ehd-notification-menu a:last-child { border-bottom: 0; }
.ehd-notification-menu a:hover { background: #f8fbff; color: var(--ehd-primary); }
.ehd-notification-menu a b { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; border-radius: 50%; background: #dbeafe; color: #1d4ed8; }
.ehd-notification-menu p { margin: 0; padding: 15px; color: #64748b; font-size: 13px; }

/* One-panel role helpdesk navigation */
.ehd-view-switcher { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin: 0 0 18px; padding: 8px; border: 1px solid var(--ehd-border); border-radius: 16px; background: var(--ehd-panel); box-shadow: var(--ehd-shadow); }
.ehd-view-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 14px; border: 0; border-radius: 11px; background: transparent; color: #475569; font: inherit; font-weight: 800; cursor: pointer; }
.ehd-view-button:hover { background: #f1f5f9; color: #1d4ed8; }
.ehd-view-button.is-active { background: linear-gradient(135deg, var(--ehd-primary), #0d4fc9); color: #fff; box-shadow: 0 9px 20px rgba(23,105,255,.22); }
.ehd-view-button b { display: inline-flex; align-items: center; justify-content: center; min-width: 25px; height: 25px; padding: 0 7px; border-radius: 999px; background: #e2e8f0; color: #334155; font-size: 11px; }
.ehd-view-button.is-active b { background: rgba(255,255,255,.2); color: #fff; }
.ehd-role-panel[hidden] { display: none !important; }

/* Full-name staff directory */
.ehd-staff-picker { width: 100%; }
.ehd-staff-checkboxes { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.ehd-staff-option { grid-template-columns: 24px minmax(0,1fr); min-height: 48px; padding: 8px 10px; border-radius: 9px; }
.ehd-staff-check-ui { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; color: transparent; font-size: 11px; font-weight: 900; }
.ehd-staff-option:has(input:checked) .ehd-staff-check-ui { border-color: var(--ehd-primary); background: var(--ehd-primary); color: #fff; }
.ehd-staff-name strong { overflow: visible; color: #172033; font-size: 13px; text-overflow: clip; white-space: normal; }
.ehd-staff-name small { font-size: 10px; }
.ehd-staff-picker--compact .ehd-staff-checkboxes { grid-template-columns: 1fr; max-height: 220px; }
.ehd-manage-staff-container { display: block; width: 100%; margin: 8px 0 12px; }
.ehd-bulk-toolbar { grid-template-columns: auto minmax(150px, 190px) minmax(170px, 220px) auto; align-items: center; }
.ehd-bulk-staff-container { grid-column: 1 / -1; width: 100%; margin-top: 2px; }
.ehd-bulk-staff-container .ehd-staff-checkboxes { grid-template-columns: repeat(3, minmax(0,1fr)); max-height: 235px; }
.ehd-bulk-toolbar .ehd-form-notice { grid-column: 1 / -1; }

/* Reply policy and immediate close */
.ehd-reply-policy { display: flex; align-items: flex-start; gap: 9px; margin-top: 13px; padding: 10px 12px; border: 1px solid #bfdbfe; border-radius: 10px; background: #eff6ff; color: #1e40af; font-size: 12px; }
.ehd-close-after-reply { display: flex; align-items: flex-start; gap: 9px; margin-top: 10px; padding: 11px 12px; border: 1px solid #fed7aa; border-radius: 10px; background: #fff7ed; cursor: pointer; }
.ehd-close-after-reply input { margin-top: 4px; }
.ehd-close-after-reply span { display: flex; flex-direction: column; color: #7c2d12; }
.ehd-close-after-reply small { color: #9a3412; font-size: 11px; }

/* Professional table template */
.ehd-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--ehd-border); border-radius: 13px; }
.ehd-list-table { width: 100%; min-width: 820px; border-collapse: collapse; background: #fff; font-size: var(--ehd-table-font-size, 14px); }
.ehd-list-table th { padding: 12px 13px; background: var(--ehd-table-heading); color: #fff; font-size: 11px; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.ehd-list-table td { padding: 12px 13px; border-bottom: 1px solid #e8eef5; color: #334155; vertical-align: middle; }
.ehd-list-table tbody tr:hover { background: #f8fbff; }
.ehd-list-table tbody tr:last-child td { border-bottom: 0; }
.ehd-table-open { min-height: 34px; padding: 6px 11px; border: 1px solid #bfdbfe; background: #eff6ff; color: #1d4ed8; font: inherit; font-size: 12px; font-weight: 900; cursor: pointer; }
.ehd-submitted-template-6 { display: grid; grid-template-columns: 55px 1fr; border: 1px solid var(--ehd-border); border-radius: 4px; background: #fff; box-shadow: none; }
.ehd-submitted-template-6 > div:last-child { display: grid; grid-template-columns: minmax(120px,.35fr) 1fr auto; align-items: center; gap: 12px; }
.ehd-submitted-template-6 h3, .ehd-submitted-template-6 p { margin: 0; }
.ehd-open-template-6 .ehd-ticket-banner { border-radius: 0; background: var(--ehd-table-heading); }
.ehd-open-template-6 .ehd-ticket-banner h2, .ehd-open-template-6 .ehd-ticket-banner p, .ehd-open-template-6 .ehd-ticket-eyebrow { color: #fff; }
.ehd-open-template-6 .ehd-ticket-workspace { gap: 0; padding: 0; background: #fff; }
.ehd-open-template-6 .ehd-ticket-main { padding: 18px; border-right: 1px solid var(--ehd-border); }
.ehd-open-template-6 .ehd-ticket-sidebar { padding: 18px; }
.ehd-open-template-6 .ehd-conversation-panel, .ehd-open-template-6 .ehd-sidebar-card, .ehd-open-template-6 .ehd-reply-form { border-radius: 4px; box-shadow: none; }
.ehd-open-template-6 .ehd-detail-list > div { grid-template-columns: 42% 58%; padding: 9px; border: 1px solid var(--ehd-border); border-bottom: 0; }
.ehd-open-template-6 .ehd-detail-list > div:last-child { border-bottom: 1px solid var(--ehd-border); }
.ehd-open-template-6 .ehd-detail-list dt { background: #f1f5f9; }
.ehd-origin-type { display: inline-flex !important; width: max-content; margin-top: 6px !important; padding: 3px 7px; border-radius: 999px; background: #e0f2fe; color: #0369a1 !important; font-weight: 800; }

/* Outside template variations */
.ehd-queue-template-2 .ehd-conversation-table { border: 0; border-radius: 24px; box-shadow: var(--ehd-shadow); }
.ehd-queue-template-3 .ehd-conversation-table { border-radius: 4px; box-shadow: none; }
.ehd-queue-template-4 .ehd-conversation-table thead th { background: linear-gradient(135deg, #0f172a, var(--ehd-primary)); }
.ehd-queue-template-5 .ehd-conversation-table { border: 2px solid #64748b; border-radius: 0; box-shadow: none; }
.ehd-queue-template-6 .ehd-conversation-table { border-radius: 4px; box-shadow: none; font-size: var(--ehd-table-font-size, 14px); }
.ehd-queue-template-6 .ehd-conversation-table thead th { border-radius: 0 !important; }

/* More compact professional queues */
.ehd-conversation-table { font-size: var(--ehd-table-font-size, 14px); }
.ehd-filter-bar { border-color: var(--ehd-border); border-radius: var(--ehd-card-radius, 18px); }
.ehd-queue-message .ehd-staff-avatar { width: 32px; height: 32px; border-radius: 8px; font-size: 10px; }
.ehd-queue-message { grid-template-columns: 32px minmax(0,1fr); }

@media (max-width: 900px) {
    .ehd-hero-card { align-items: flex-start; }
    .ehd-view-switcher { grid-template-columns: 1fr; }
    .ehd-view-button { justify-content: flex-start; }
    .ehd-bulk-staff-container .ehd-staff-checkboxes { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .ehd-submitted-template-6 > div:last-child { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .ehd-app { padding: var(--ehd-page-mobile-padding, 12px); }
    .ehd-hero-card { flex-direction: column; gap: 14px; padding: var(--ehd-hero-mobile-padding, 18px); }
    .ehd-hero-card h2 { font-size: min(var(--ehd-hero-heading-size, 34px), 30px); }
    .ehd-notifications, .ehd-notification-button { width: 100%; }
    .ehd-notification-button { justify-content: center; }
    .ehd-notification-menu { left: 0; right: auto; width: 100%; }
    .ehd-ticket-form, .ehd-list-card { padding: 16px; }
    .ehd-staff-checkboxes, .ehd-bulk-staff-container .ehd-staff-checkboxes { grid-template-columns: 1fr; }
    .ehd-staff-picker__toolbar { grid-template-columns: 1fr 1fr; }
    .ehd-staff-search-wrap { grid-column: 1 / -1; }
    .ehd-bulk-toolbar { grid-template-columns: 1fr; }
    .ehd-bulk-staff-container, .ehd-bulk-toolbar .ehd-form-notice { grid-column: auto; }
    .ehd-view-switcher { padding: 6px; }
}
.ehd-app { background: var(--ehd-bg, #eef5ff); border-radius: calc(var(--ehd-card-radius, 18px) + 4px); }
.ehd-list-table .ehd-ticket-list__item { display: table-row; width: auto; border: 0; border-radius: 0; background: transparent; box-shadow: none; transform: none; }
.ehd-list-table .ehd-ticket-list__item[hidden] { display: none; }
.ehd-list-table .ehd-empty { padding: 28px; text-align: center; color: #64748b; }
.ehd-open-summary-wrap { padding: 16px 18px 0; background: #fff; }
.ehd-open-summary-table, .ehd-submitted-table { width: 100%; border-collapse: collapse; background: #fff; font-size: var(--ehd-table-font-size, 14px); }
.ehd-open-summary-table th, .ehd-open-summary-table td, .ehd-submitted-table th, .ehd-submitted-table td { padding: 10px 12px; border: 1px solid var(--ehd-border); text-align: left; vertical-align: top; }
.ehd-open-summary-table th, .ehd-submitted-table th { width: 145px; background: #f1f5f9; color: #334155; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.ehd-submitted-table-wrap { overflow-x: auto; border: 1px solid var(--ehd-border); border-radius: 4px; background: #fff; }
.ehd-submitted-table .ehd-ticket-success-link { margin: 0; }
@media(max-width:640px){.ehd-open-summary-table,.ehd-open-summary-table tbody,.ehd-open-summary-table tr,.ehd-open-summary-table th,.ehd-open-summary-table td{display:block;width:100%}.ehd-open-summary-table th{border-bottom:0}.ehd-open-summary-table td{border-top:0}}
.ehd-filter-bar, .ehd-list-card .ehd-filter-bar { display:flex; flex-wrap:wrap; grid-template-columns:none; }
.ehd-filter-bar .ehd-filter-search { flex:1 1 260px; }
.ehd-filter-bar select { flex:0 1 165px; }
.ehd-filter-bar .ehd-secondary-button { flex:0 0 auto; }
@media(max-width:640px){.ehd-filter-bar .ehd-filter-search,.ehd-filter-bar select,.ehd-filter-bar .ehd-secondary-button{flex:1 1 100%;width:100%}}

/* Version 1.2.2 status synchronization and routing restrictions */
.ehd-role-app.is-refreshing-tickets .ehd-view-switcher{opacity:.82}
.ehd-role-app.is-refreshing-tickets .ehd-view-button.is-active:after{content:"";width:13px;height:13px;border:2px solid rgba(255,255,255,.45);border-top-color:#fff;border-radius:50%;animation:ehdTicketRefresh .7s linear infinite}
@keyframes ehdTicketRefresh{to{transform:rotate(360deg)}}
.ehd-reply-success{margin:0 0 14px;border:1px solid #a7f3d0;border-radius:12px;background:#ecfdf5;color:#065f46;font-weight:700}
.ehd-source-label{display:block;margin-top:4px;color:#0369a1;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.04em}

.ehd-routing-note{margin:14px 0 4px;padding:12px 14px;border:1px solid var(--ehd-border,#dbe3ee);border-radius:10px;background:var(--ehd-page-bg,#f7f9fc);font-size:13px;line-height:1.55;color:var(--ehd-text,#334155)}
