/* M09 help desk — back office + public pages. Every class is prefixed hd- (no collisions with site.css / ui.css). */
.hd-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.hd-page > * { min-width: 0; }
.hd-page .ui-page-head { flex-wrap: wrap; gap: 8px; }
.hd-page .muted, .hd-muted { color: var(--ui-muted, #6b7380); }
.hd-page .small { font-size: 0.8rem; }
.hd-page .mono, .hd-detail-head .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }
.hd-page .nowrap { white-space: nowrap; }
.hd-page .grow { flex: 1; }
.hd-page .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-indigo { color: #4338ca; } .hd-green { color: #15803d; } .hd-red { color: #b91c1c; } .hd-teal { color: #0f766e; } .hd-emerald { color: #047857; font-weight: 600; }

/* workspace switch */
.hd-ws { display: inline-flex; gap: 4px; padding: 4px; background: var(--ui-secondary, #f1eee8); border-radius: 12px; max-width: 100%; overflow-x: auto; }
.hd-ws button { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; cursor: pointer; text-align: left; font: inherit; position: relative; }
.hd-ws button small { display: block; color: var(--ui-muted); font-size: 0.72rem; }
.hd-ws button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.hd-ws .ico { font-size: 1.1rem; }
.hd-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: #2563eb; }

/* stat bar */
.hd-statbar { display: flex; gap: 6px; align-items: center; overflow-x: auto; max-height: 52px; padding-bottom: 2px; }
.hd-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ui-border, #e7e3dc); background: #fff; border-radius: 999px; padding: 5px 11px; font: 500 0.82rem/1 inherit; cursor: pointer; white-space: nowrap; min-height: 28px; }
.hd-pill.on { border-color: var(--ui-primary); box-shadow: 0 0 0 2px var(--ui-ring); }
.hd-sep { width: 1px; height: 20px; background: var(--ui-border); flex: none; }
.hd-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; flex: none; }
.hd-dot-blue { background: #2563eb; } .hd-dot-amber { background: #d97706; } .hd-dot-green { background: #16a34a; } .hd-dot-gray { background: #9ca3af; }
.hd-tabs { overflow-x: auto; }

/* chips */
.hd-chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.hd-c-red { background: #fde2e7; color: #4e1224; } .hd-c-blue { background: #dbeafe; color: #1d4ed8; } .hd-c-green { background: #dcfce7; color: #15803d; }
.hd-c-yellow { background: #fef9c3; color: #a16207; } .hd-c-pink { background: #fce7f3; color: #be185d; } .hd-c-purple { background: #f3e8ff; color: #7e22ce; }
.hd-c-orange { background: #ffedd5; color: #c2410c; } .hd-c-teal { background: #ccfbf1; color: #0f766e; } .hd-c-slate { background: #e2e8f0; color: #334155; }

/* filters */
.hd-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hd-filters .ui-select { width: auto; max-width: 200px; height: 34px; font-size: 0.82rem; }
.hd-search { position: relative; flex: 1 1 240px; min-width: 200px; }
.hd-search .ui-x { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.hd-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.hd-pills:empty { display: none; }
.hd-fpill { border: 0; background: #f3e8ff; color: #6b21a8; border-radius: 999px; padding: 3px 10px; font-size: 0.75rem; cursor: pointer; }
.hd-folder-strip { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; border-radius: 10px; padding: 8px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hd-bulk { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: #dbeafe; border: 1px solid #93c5fd; border-radius: 10px; padding: 8px 12px; }
.hd-sel-sm { width: auto !important; height: 32px; font-size: 0.82rem; }
.hd-btn-orange { background: #ea580c; color: #fff; } .hd-btn-orange:hover { background: #c2410c; }
.hd-btn-redline { background: #fff; color: #b91c1c; border-color: #fca5a5; }
.hd-btn-yellow { background: #ca8a04; color: #fff; } .hd-btn-yellow:hover { background: #a16207; }
.hd-refreshing { background: #dbeafe; color: #1d4ed8; font-size: 0.78rem; padding: 4px 12px; }

/* table */
.hd-table td { padding-top: 6px; padding-bottom: 6px; vertical-align: middle; }
.hd-table tr.hd-unread .t { font-weight: 700; }
.hd-subj { min-width: 220px; max-width: 420px; }
.hd-subj .l1 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hd-subj .t { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-subj .l2 { font-size: 0.75rem; display: flex; gap: 8px; margin-top: 2px; }
.hd-star { border: 0; background: none; cursor: pointer; font-size: 1rem; color: #9ca3af; padding: 0; }
.hd-star.on { color: #eab308; }
.hd-bell { font-size: 0.7rem; margin-left: 2px; }
.hd-cust { display: flex; gap: 8px; align-items: center; min-width: 160px; }
.hd-cust .n { font-weight: 500; }
.hd-cust .e { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-av { width: 30px; height: 30px; border-radius: 50%; border: 0; color: #fff; font: 700 0.72rem/30px inherit; text-align: center; cursor: pointer; flex: none; padding: 0; }
.hd-av.lg { width: 42px; height: 42px; line-height: 42px; font-size: 0.9rem; }
.hd-av-green { background: #16a34a; } .hd-av-red { background: #dc2626; } .hd-av-gray { background: #9ca3af; }
@media (max-width: 1279px) { .hd-xl { display: none; } }
@media (max-width: 1023px) { .hd-lg { display: none; } }
@media (max-width: 767px) { .hd-md, .hd-hide-sm { display: none; } }

/* dialogs bits */
.hd-rule { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--ui-border); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.hd-rule-open { border: 0; background: #ffedd5; border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 1.1rem; }
.hd-label-new { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.hd-label-new .ui-input { flex: 1; min-width: 140px; }
.hd-label-new .ui-select { width: auto; }
.hd-label-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--ui-border); flex-wrap: wrap; }
.hd-lookup { display: flex; gap: 6px; margin-bottom: 8px; }
.hd-nt-head { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.hd-email-now { display: flex; gap: 8px; align-items: flex-start; background: #f6f3ee; border-radius: 10px; padding: 10px; margin: 10px 0; }
.hd-ok { background: #dcfce7; color: #166534; } .hd-warn { background: #fef9c3; color: #854d0e; }
.hd-pop-head { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.hd-links { display: flex; gap: 6px; flex-wrap: wrap; }

/* editor */
.hd-editor { border: 1px solid var(--ui-input, #ddd8cf); border-radius: 10px; background: #fff; overflow: hidden; }
.hd-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--ui-border); background: #faf9f6; align-items: center; }
.hd-toolbar button { border: 0; background: transparent; min-width: 30px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 0.82rem; }
.hd-toolbar button:hover { background: #ece8e1; }
.hd-toolbar .sep { width: 1px; height: 18px; background: var(--ui-border); margin: 0 4px; }
.hd-merge { height: 28px; font-size: 0.78rem; border: 1px solid var(--ui-border); border-radius: 6px; max-width: 220px; }
.hd-edit { padding: 12px; outline: none; max-height: 600px; overflow-y: auto; font-size: 0.92rem; line-height: 1.55; }
.hd-edit:empty::before { content: attr(data-placeholder); color: #9ca3af; }
.hd-edit p { margin: 0 0 8px; }

/* ticket detail */
.hd-detail-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hd-collision { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; border-radius: 10px; padding: 8px 12px; }
.hd-sla { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border: 1px solid var(--ui-border); background: #fff; border-radius: 10px; padding: 8px 12px; font-size: 0.85rem; }
.hd-sla-part { padding: 2px 8px; border-radius: 999px; }
.hd-sla-part.ok { background: #dcfce7; color: #166534; } .hd-sla-part.warn { background: #fef3c7; color: #92400e; } .hd-sla-part.bad { background: #fee2e2; color: #991b1b; }
.hd-detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1023px) { .hd-detail { grid-template-columns: minmax(0, 1fr); } }
.hd-left, .hd-right { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.hd-left > *, .hd-right > * { min-width: 0; }
#d-tabs { overflow-x: auto; }
.hd-subject { font-size: 1.3rem; margin: 0 0 12px; word-break: break-word; }
.hd-meta4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .hd-meta4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hd-meta4 label, .hd-meta4 .lbl, .hd-right .lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ui-muted); display: grid; gap: 4px; }
.hd-tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.hd-quar { margin-top: 10px; background: #fee2e2; color: #991b1b; padding: 8px 10px; border-radius: 8px; display: flex; gap: 8px; align-items: center; }
.hd-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.hd-msg { background: #fff; border: 1px solid var(--ui-border); border-left: 4px solid #9ca3af; border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.hd-msg-agent { border-left-color: #2563eb; } .hd-msg-note { border-left-color: #eab308; background: #fffbeb; } .hd-msg-system { border-left-color: #cbd5e1; opacity: .9; }
.hd-msg-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--ui-border); }
.hd-msg-body { padding: 10px 12px; }
.hd-msg.collapsed .hd-msg-body { display: none; }
.hd-msg iframe { width: 100%; border: 0; min-height: 40px; display: block; }
.hd-atts, .hd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hd-att { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--ui-border); border-radius: 8px; padding: 3px 8px; font-size: 0.8rem; background: #fafafa; }
.hd-att button { border: 0; background: none; cursor: pointer; }
.hd-composer { padding: 10px; }
.hd-composer.note { background: #fffbeb; border-color: #fde68a; }
.hd-comp-head, .hd-comp-tools, .hd-comp-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.hd-comp-foot { margin: 10px 0 0; }
.hd-seg { display: inline-flex; background: var(--ui-secondary); border-radius: 8px; padding: 2px; }
.hd-seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; cursor: pointer; font: 500 0.82rem inherit; }
.hd-seg button.on { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.hd-canned { display: grid; gap: 4px; max-height: 260px; overflow: auto; border: 1px solid var(--ui-border); border-radius: 8px; padding: 6px; margin-bottom: 8px; }
.hd-canned button { display: grid; text-align: left; border: 0; background: #fff; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.hd-canned button:hover { background: #f6f3ee; }
.hd-preview { border: 1px dashed var(--ui-border); border-radius: 8px; padding: 10px; margin-top: 8px; background: #fff; }
.hd-mt-ok { color: #1d4ed8; font-weight: 600; } .hd-mt-bad { color: #b91c1c; font-weight: 600; }
.hd-resolved { background: #dcfce7; color: #166534; padding: 10px; border-radius: 8px; margin-bottom: 10px; }
.hd-time-form { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; align-items: center; }
.hd-time-form .ui-input[type=number] { width: 100px; }
.hd-li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--ui-border); color: inherit; text-decoration: none; min-width: 0; }
.hd-profile.known { border-top: 3px solid #16a34a; }
.hd-unknown { border-top: 3px solid #ea580c; background: #fff7ed; }
.hd-idcard { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.hd-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.hd-note-add { display: grid; gap: 6px; margin-top: 10px; }
.hd-own-lock { background: #eff6ff; color: #1d4ed8; }
.hd-csat .hd-stars { color: #eab308; font-size: 1.3rem; }
.hd-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }

/* settings */
.hd-desk summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; cursor: pointer; }
.hd-inbound-box { background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 10px; padding: 10px; margin: 8px 0; word-break: break-all; }
.hd-amber { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 8px; }
.hd-checks { display: flex; flex-wrap: wrap; gap: 12px; }
.hd-bar { display: grid; grid-template-columns: 34px 1fr 40px; gap: 8px; align-items: center; font-size: 0.82rem; margin: 4px 0; }
.hd-bar div { background: #f1eee8; border-radius: 999px; height: 10px; overflow: hidden; }
.hd-bar i { display: block; height: 100%; background: #eab308; }
.hd-cards { display: flex; gap: 8px; overflow-x: auto; }
.hd-statcard { border: 1px solid var(--ui-border); background: #fff; border-radius: 12px; padding: 10px 14px; display: grid; text-align: left; cursor: pointer; min-width: 120px; }
.hd-statcard.on { border-color: var(--ui-primary); box-shadow: 0 0 0 2px var(--ui-ring); }
.hd-statcard b { font-size: 1.3rem; }
.hd-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hd-csat-banner { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; padding: 16px; border-radius: 12px; color: #fff; }
.hd-csat-banner.good { background: linear-gradient(135deg, #15803d, #22c55e); } .hd-csat-banner.ok { background: linear-gradient(135deg, #b45309, #f59e0b); } .hd-csat-banner.bad { background: linear-gradient(135deg, #991b1b, #ef4444); }
.hd-csat-banner .big { font-size: 1.8rem; font-weight: 700; }
.hd-about { background: #eff6ff; color: #1e3a8a; margin-bottom: 8px; }

/* public pages */
.hd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.hd-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.hd-kb-group { margin-bottom: 16px; }
.hd-kb-group p { margin: 0 0 8px; }
.hd-kb-hit { display: grid; gap: 2px; margin-bottom: 8px; padding: 12px 14px; }
.hd-req { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 8px; }
.hd-req > span:first-child { display: grid; gap: 2px; min-width: 0; }
.hd-st { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 0.78rem; font-weight: 600; background: #e5e7eb; color: #374151; white-space: nowrap; }
.hd-st-open, .hd-st-new, .hd-st-in_progress { background: #dbeafe; color: #1d4ed8; } .hd-st-resolved { background: #dcfce7; color: #15803d; } .hd-st-on_hold { background: #ffedd5; color: #c2410c; }
.hd-cmsg { margin-bottom: 12px; overflow-wrap: anywhere; }
.hd-cmsg.us { border-left: 4px solid #4e1224; }
.hd-cbody img { max-width: 100%; height: auto; }
.hd-rate { text-align: center; max-width: 520px; margin: 0 auto; }
.hd-rate-logo { max-height: 48px; margin-bottom: 8px; }
.hd-stars-pick { display: flex; justify-content: center; gap: 6px; margin: 12px 0 4px; }
.hd-stars-pick .s { border: 0; background: none; font-size: 2.4rem; color: #d1d5db; cursor: pointer; line-height: 1; }
.hd-stars-pick .s.on.s1, .hd-rate-btn.s1 { color: #dc2626; } .hd-stars-pick .s.on.s2 { color: #ea580c; } .hd-stars-pick .s.on.s3 { color: #ca8a04; } .hd-stars-pick .s.on.s4 { color: #65a30d; } .hd-stars-pick .s.on.s5 { color: #16a34a; }
.hd-rate-btn.s1 { background: #dc2626; color: #fff; } .hd-rate-btn.s2 { background: #ea580c; } .hd-rate-btn.s3 { background: #ca8a04; } .hd-rate-btn.s4 { background: #65a30d; } .hd-rate-btn.s5 { background: #16a34a; }
.hd-star-label { min-height: 1.2em; font-weight: 600; margin-bottom: 8px; }
.hd-rate textarea { width: 100%; margin: 8px 0; }
.hd-rate-ok { width: 56px; height: 56px; border-radius: 50%; background: #dcfce7; color: #16a34a; font-size: 2rem; line-height: 56px; margin: 0 auto 8px; }
.hd-spin { animation: hdspin 0.8s linear infinite; }
@keyframes hdspin { to { transform: rotate(360deg); } }
