/* ============================================
   oneBase Helpdesk — Professional Support UI
   Built with style.css variables
   ============================================ */

/* ===== Layout Shell ===== */
.hd {
    display: flex;
    min-height: calc(100vh - 72px);
    margin-top: 64px;
    background: var(--color-bg);
}

/* ===== Sidebar ===== */
.hd-sidebar {
    width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
}

.hd-sidebar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
}

.hd-sidebar__title {
    font-family: 'Bricolage Grotesque', var(--font-sans);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.hd-sidebar__title svg { color: var(--color-primary); }

.hd-sidebar__new {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}
.hd-sidebar__new:hover { background: var(--color-primary-hover); box-shadow: var(--shadow-md); }

/* Back link */
.hd-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: var(--transition);
}
.hd-back:hover { color: var(--color-primary); }

/* Filters */
.hd-filters {
    display: flex;
    gap: 4px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}
.hd-filter {
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.hd-filter:hover { color: var(--color-text); background: var(--color-surface); }
.hd-filter--active {
    background: var(--color-surface);
    color: var(--color-primary);
    border-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}

/* ===== Ticket List ===== */
.hd-list {
    flex: 1;
    overflow-y: auto;
}

.hd-item {
    display: block;
    padding: 16px 24px;
    text-decoration: none;
    border-bottom: 1px solid var(--color-border);
    transition: var(--transition);
    position: relative;
}
.hd-item:hover { background: #f8fafc; }
.hd-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: transparent;
    transition: var(--transition);
}
.hd-item:hover::after { background: var(--color-primary); }

.hd-item__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.hd-item__id {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    letter-spacing: 0.02em;
}
.hd-item__time {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
}

.hd-item__subject {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hd-item__footer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hd-item__product {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: var(--color-bg);
    padding: 2px 8px;
    border-radius: 4px;
}

.hd-item__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.hd-item__dot--low { background: var(--color-success); }
.hd-item__dot--medium { background: var(--color-warning); }
.hd-item__dot--high { background: var(--color-error); }
.hd-item__dot--critical { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }

/* Status pill */
.hd-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.hd-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.hd-status--open { background: #eff6ff; color: #2563eb; }
.hd-status--open::before { background: #2563eb; }
.hd-status--in_progress { background: #fffbeb; color: #d97706; }
.hd-status--in_progress::before { background: #d97706; }
.hd-status--waiting { background: #f5f3ff; color: #7c3aed; }
.hd-status--waiting::before { background: #7c3aed; }
.hd-status--resolved { background: #ecfdf5; color: #059669; }
.hd-status--resolved::before { background: #059669; }
.hd-status--closed { background: #f3f4f6; color: #6b7280; }
.hd-status--closed::before { background: #9ca3af; }

/* Priority pill */
.hd-priority {
    font-size: 0.75rem;
    font-weight: 600;
}
.hd-priority--low { color: var(--color-success); }
.hd-priority--medium { color: var(--color-warning); }
.hd-priority--high { color: var(--color-error); }
.hd-priority--critical { color: #dc2626; }

/* Empty state */
.hd-empty {
    padding: 60px 24px;
    text-align: center;
}
.hd-empty__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--color-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hd-empty__icon svg { color: var(--color-text-secondary); opacity: 0.4; }
.hd-empty h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 6px;
}
.hd-empty p {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

/* Welcome (no ticket selected) */
.hd-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--color-text-secondary);
}
.hd-welcome__icon {
    width: 80px;
    height: 80px;
    background: var(--color-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.hd-welcome__icon svg { color: var(--color-text-secondary); opacity: 0.25; }
.hd-welcome h3 { font-size: 1rem; font-weight: 600; color: var(--color-text-secondary); }
.hd-welcome a { color: var(--color-primary); font-weight: 500; }

/* ===== Main Panel ===== */
.hd-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--color-bg);
}

/* ===== Detail Sidebar ===== */
.hd-detail-info {
    padding: 24px;
    flex: 1;
}
.hd-detail-info__id {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    letter-spacing: 0.02em;
}
.hd-detail-info__subject {
    font-family: 'Bricolage Grotesque', var(--font-sans);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.35;
    margin: 8px 0 24px;
}

.hd-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.hd-meta__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}
.hd-meta__row:last-child { border-bottom: none; }
.hd-meta__label {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}
.hd-meta__value {
    font-size: 0.82rem;
    color: var(--color-text);
    font-weight: 500;
}

/* ===== Chat Area ===== */
.hd-chat {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: var(--color-bg);
}

.hd-date-sep {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0 20px;
}
.hd-date-sep::before,
.hd-date-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}
.hd-date-sep span {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Message */
.hd-msg {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    max-width: 75%;
}

/* User messages — align RIGHT */
.hd-msg--user {
    margin-left: auto;
    flex-direction: row-reverse;
}

/* Staff messages — align LEFT */
.hd-msg--staff {
    margin-right: auto;
}

.hd-msg__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
}
.hd-msg__avatar--user {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1d4ed8;
}
.hd-msg__avatar--staff {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #047857;
}

.hd-msg__content { flex: 1; min-width: 0; }

.hd-msg__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}
/* User head — align right */
.hd-msg--user .hd-msg__head {
    justify-content: flex-end;
}

.hd-msg__author {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}
.hd-msg__badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 4px;
}
.hd-msg--user .hd-msg__badge {
    background: #dbeafe;
    color: #1d4ed8;
}
.hd-msg--staff .hd-msg__badge {
    background: #d1fae5;
    color: #047857;
}
.hd-msg__time {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
}

.hd-msg__body {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--color-text);
    padding: 14px 18px;
    box-shadow: var(--shadow-sm);
}

/* User bubble — blue tint, rounded top-right flat */
.hd-msg--user .hd-msg__body {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 12px 2px 12px 12px;
}

/* Staff bubble — white/surface, rounded top-left flat */
.hd-msg--staff .hd-msg__body {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 2px 12px 12px 12px;
}

/* Files in message */
.hd-msg__files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.hd-msg__file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}
.hd-msg__file:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}
.hd-msg__file svg { color: var(--color-text-secondary); flex-shrink: 0; }
.hd-msg__file:hover svg { color: var(--color-primary); }
.hd-msg__file span {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hd-msg__file small { color: var(--color-text-secondary); font-size: 0.7rem; }

/* Waiting */
.hd-waiting {
    text-align: center;
    padding: 40px 0;
}
.hd-waiting__dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 12px;
}
.hd-waiting__dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border);
    animation: hd-pulse 1.4s ease-in-out infinite;
}
.hd-waiting__dots span:nth-child(2) { animation-delay: 0.2s; }
.hd-waiting__dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes hd-pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.1); }
}
.hd-waiting p { font-size: 0.85rem; color: var(--color-text-secondary); }

/* ===== Input Bar ===== */
.hd-inputbar {
    padding: 20px 32px 24px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}
.hd-inputbar--closed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    font-size: 0.88rem;
    color: var(--color-text-secondary);
    background: #fafafa;
}
.hd-inputbar--closed a { color: var(--color-primary); font-weight: 600; text-decoration: none; }
.hd-inputbar--closed a:hover { text-decoration: underline; }

/* ===== Resolution Panel ===== */
.hd-resolve-panel {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    border-top: 1px solid #d1fae5;
}
.hd-resolve-panel__header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 32px 0;
}
.hd-resolve-panel__icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #d1fae5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #059669;
}
.hd-resolve-panel__title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.hd-resolve-panel__title strong {
    font-size: 0.92rem;
    color: var(--color-text);
    font-weight: 700;
}
.hd-resolve-panel__note {
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
}
.hd-resolve-panel__version {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 12px 32px 0;
    padding: 6px 14px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    width: fit-content;
}
.hd-resolve-panel__version strong {
    font-family: var(--font-mono);
    font-weight: 700;
}
.hd-resolve-panel__question {
    padding: 14px 32px 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text);
}
.hd-resolve-panel__body {
    padding: 12px 32px 20px;
}
.hd-resolve-panel__feedback {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #d1fae5;
    border-radius: 8px;
    background: rgba(255,255,255,0.7);
    color: var(--color-text);
    font-size: 0.88rem;
    font-family: inherit;
    line-height: 1.6;
    resize: none;
    outline: none;
    margin-bottom: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.hd-resolve-panel__feedback:focus {
    border-color: #059669;
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.08);
}
.hd-resolve-panel__feedback::placeholder {
    color: #9ca3af;
}
.hd-resolve-panel__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Star Rating */
.hd-stars {
    margin-bottom: 14px;
}
.hd-stars__label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}
.hd-stars__row {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 2px;
}
.hd-stars__input {
    display: none;
}
.hd-stars__star {
    font-size: 2rem;
    color: #d1d5db;
    cursor: pointer;
    transition: color 0.15s, transform 0.15s;
    line-height: 1;
    padding: 0 2px;
    user-select: none;
}
.hd-stars__star:hover,
.hd-stars__star:hover ~ .hd-stars__star {
    color: #f59e0b;
    transform: scale(1.1);
}
.hd-stars__input:checked ~ .hd-stars__star {
    color: #f59e0b;
}

/* Confirm/Reject buttons (shared) */
.hd-resolve-confirm__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-family: inherit;
}
.hd-resolve-confirm__btn--yes {
    background: #059669;
    color: #fff;
}
.hd-resolve-confirm__btn--yes:hover {
    background: #047857;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.hd-resolve-confirm__btn--no {
    background: rgba(255,255,255,0.7);
    color: var(--color-text);
    border: 1.5px solid #d1fae5;
}
.hd-resolve-confirm__btn--no:hover {
    border-color: var(--color-error);
    color: var(--color-error);
    background: #fef2f2;
}

/* Closed summary bar */
.hd-closed-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 32px;
    background: #f8fafc;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
}
.hd-closed-summary__rating {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #059669;
    font-size: 0.88rem;
    font-weight: 500;
}
.hd-closed-summary__info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary);
    font-size: 0.88rem;
}
.hd-closed-summary__new {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
}
.hd-closed-summary__new:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
    .hd-resolve-panel__header { padding: 16px 20px 0; }
    .hd-resolve-panel__version { margin: 10px 20px 0; }
    .hd-resolve-panel__question { padding: 12px 20px 0; }
    .hd-resolve-panel__body { padding: 10px 20px 16px; }
    .hd-resolve-panel__actions { flex-direction: column; }
    .hd-resolve-confirm__btn { justify-content: center; width: 100%; }
    .hd-closed-summary { flex-direction: column; padding: 12px 20px; }
}

.hd-inputbar__files {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.hd-inputbar__file-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    background: #eff6ff;
    color: var(--color-primary);
    font-size: 0.78rem;
    font-weight: 500;
    border: 1px solid #dbeafe;
}

.hd-inputbar__row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 10px;
    border: 1.5px solid var(--color-border);
    border-radius: 12px;
    padding: 10px 12px 10px 6px;
    background: var(--color-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.hd-inputbar__row:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37,99,235,0.07);
}

.hd-inputbar__attach {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: 10px;
    transition: var(--transition);
}
.hd-inputbar__attach:hover { color: var(--color-primary); background: #eff6ff; }

.hd-inputbar__field {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--color-text);
    font-size: 0.92rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    min-height: 44px;
    max-height: 200px;
    font-family: inherit;
    padding: 8px 10px;
    box-sizing: border-box;
}
.hd-inputbar__field::placeholder { color: #9ca3af; }

.hd-inputbar__send {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.hd-inputbar__send:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.hd-inputbar__hint {
    margin-top: 8px;
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    opacity: 0.7;
    text-align: right;
}

/* ===== Create Form ===== */
.hd-sidebar--create .hd-sidebar__head {
    justify-content: flex-start;
}

.hd-create-info {
    padding: 24px 24px 16px;
}
.hd-create-info h2 {
    font-family: 'Bricolage Grotesque', var(--font-sans);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
}
.hd-create-info p {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.hd-tips {
    padding: 0 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.hd-tip {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    padding: 8px 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}
.hd-tip svg { flex-shrink: 0; opacity: 0.5; }

/* Form */
.hd-form {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

.hd-form__row--half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.hd-field {
    margin-bottom: 20px;
}
.hd-field__label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 6px;
}
.hd-field__label-opt {
    font-weight: 400;
    color: var(--color-text-secondary);
}

.hd-field__input,
.hd-field__select,
.hd-field__textarea {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.92rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-sizing: border-box;
}
.hd-field__input:focus,
.hd-field__select:focus,
.hd-field__textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37,99,235,0.07);
}

.hd-field__select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.hd-field__textarea {
    resize: vertical;
    min-height: 160px;
    line-height: 1.7;
}

.hd-field__error {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--color-error);
    font-weight: 500;
}

/* Dropzone */
.hd-dropzone {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    transition: var(--transition);
    cursor: pointer;
}
.hd-dropzone:hover,
.hd-dropzone--active {
    border-color: var(--color-primary);
    background: #eff6ff;
}
.hd-dropzone__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.hd-dropzone__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}
.hd-dropzone__content strong { color: var(--color-primary); }
.hd-dropzone__content small { font-size: 0.75rem; opacity: 0.7; }
.hd-dropzone__files {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
}
.hd-dropzone__file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: #eff6ff;
    font-size: 0.82rem;
    color: var(--color-primary);
    font-weight: 500;
}
.hd-dropzone__file small { margin-left: auto; opacity: 0.6; font-weight: 400; }

.hd-form__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
}
.hd-form__privacy {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
}
.hd-form__submit {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.hd-form__submit:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
}

/* Alert */
.hd-alert--error {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* ==============================================
   Knowledge Base — Professional Design System
   ============================================== */

/* Hero */
.kb-hero {
    margin-top: 64px;
    background: linear-gradient(135deg, #f8faff 0%, #eef2ff 50%, #f0f9ff 100%);
    border-bottom: 1px solid #e0e7ff;
    padding: 64px 24px 56px;
    overflow: visible;
    position: relative;
    z-index: 10;
}
.kb-hero__inner {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    padding-bottom: 8px;
}
.kb-hero__title {
    font-family: 'Bricolage Grotesque', var(--font-sans);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}
.kb-hero__subtitle {
    font-size: 1rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 28px;
}

/* Search */
.kb-search {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 14px;
    border: 2px solid #e0e7ff;
    box-shadow: 0 4px 24px rgba(37, 99, 235, 0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
}
.kb-search:focus-within {
    border-color: #2563eb;
    box-shadow: 0 4px 24px rgba(37, 99, 235, 0.12);
}
.kb-search__icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
    pointer-events: none;
}
.kb-search__input,
.kb-search input[type="text"] {
    flex: 1 1 0% !important;
    width: auto !important;
    min-width: 0;
    border: none !important;
    outline: none;
    padding: 16px 16px 16px 50px !important;
    font-size: 0.95rem;
    background: none !important;
    font-family: inherit;
    color: var(--color-text);
    box-shadow: none !important;
    border-radius: 0 !important;
}
.kb-search__input::placeholder {
    color: #94a3b8;
}
.kb-search__btn,
.kb-search button {
    flex: 0 0 auto !important;
    width: auto !important;
    padding: 10px 28px;
    margin: 6px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
    white-space: nowrap;
}
.kb-search__btn:hover {
    background: #1d4ed8;
}
.kb-search__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    z-index: 100;
    max-height: 360px;
    overflow-y: auto;
}
.kb-search__result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.1s;
    border-bottom: 1px solid #f1f5f9;
}
.kb-search__result:last-child {
    border-bottom: none;
}
.kb-search__result:hover {
    background: #f8fafc;
}
.kb-search__result-title {
    font-size: 0.88rem;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kb-search__result-cat {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 100px;
    white-space: nowrap;
    flex-shrink: 0;
}
.kb-search__empty {
    padding: 20px 18px;
    text-align: center;
    font-size: 0.85rem;
    color: #94a3b8;
}

/* Body */
.kb-body {
    padding: 40px 24px 80px;
    background: var(--color-bg);
    min-height: 50vh;
}
.kb-container {
    max-width: 880px;
    margin: 0 auto;
}

/* Sections */
.kb-section {
    margin-bottom: 48px;
}
.kb-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.kb-section__title {
    font-family: 'Bricolage Grotesque', var(--font-sans);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
}
.kb-section__desc {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}
.kb-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
}
.kb-link:hover {
    text-decoration: underline;
}

/* Category cards */
.kb-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.kb-cat-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 18px 20px;
    border-radius: 14px;
    background: white;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: all 0.2s;
}
.kb-cat-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
    transform: translateY(-2px);
}
.kb-cat-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.kb-cat-card:hover .kb-cat-card__icon {
    background: #eff6ff;
    color: #2563eb;
}
.kb-cat-card__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
}
.kb-cat-card__arrow {
    color: #cbd5e1;
    flex-shrink: 0;
    transition: all 0.2s;
}
.kb-cat-card:hover .kb-cat-card__arrow {
    color: #2563eb;
    transform: translateX(2px);
}
.kb-cat-card__subs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    width: 100%;
}
.kb-cat-card__sub {
    font-size: 0.68rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 1px 8px;
    border-radius: 100px;
    white-space: nowrap;
}

/* Subcategory tabs */
.kb-subcats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}
.kb-subcat {
    display: inline-block;
    padding: 6px 16px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 100px;
    text-decoration: none;
    transition: all 0.15s;
}
.kb-subcat:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #2563eb;
}
.kb-subcat--active {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}
.kb-subcat--active:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: white;
}

/* Article list */
.kb-articles-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.kb-article {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 12px;
    background: white;
    border: 1px solid #f1f5f9;
    text-decoration: none;
    transition: all 0.15s;
}
.kb-article:hover {
    border-color: #dbeafe;
    background: #fafcff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.04);
}
.kb-article__rank {
    flex-shrink: 0;
}
.kb-article__body {
    flex: 1;
    min-width: 0;
}
.kb-article__title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 3px;
    line-height: 1.4;
}
.kb-article:hover .kb-article__title {
    color: #2563eb;
}
.kb-article__excerpt {
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.kb-article__meta {
    display: flex;
    gap: 10px;
    font-size: 0.72rem;
    color: #94a3b8;
    align-items: center;
}
.kb-article__cat {
    font-weight: 600;
    color: #2563eb;
    background: #eff6ff;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
}
.kb-article__arrow {
    color: #cbd5e1;
    flex-shrink: 0;
    transition: all 0.15s;
}
.kb-article:hover .kb-article__arrow {
    color: #2563eb;
    transform: translateX(3px);
}

/* Empty state */
.kb-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-text-secondary);
}
.kb-empty svg { margin-bottom: 16px; }
.kb-empty p { font-size: 0.95rem; margin-bottom: 6px; }
.kb-empty__hint { font-size: 0.85rem; }
.kb-empty__hint a { color: #2563eb; text-decoration: none; font-weight: 500; }

/* CTA */
.kb-cta {
    margin-top: 20px;
}
.kb-cta__inner {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}
.kb-cta__inner svg { margin-bottom: 12px; }
.kb-cta__inner h3 {
    font-family: 'Bricolage Grotesque', var(--font-sans);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-text);
}
.kb-cta__inner p {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}
.kb-cta__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: #2563eb;
    color: white;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
}
.kb-cta__btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* ==============================================
   KB Detail Page
   ============================================== */
.kb-detail {
    margin-top: 64px;
    display: flex;
    min-height: calc(100vh - 64px);
}

/* Sidebar */
.kb-detail__sidebar {
    width: 280px;
    flex-shrink: 0;
    padding: 28px 24px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
}
.kb-detail__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 6px 0;
    transition: color 0.15s;
}
.kb-detail__back:hover { color: #2563eb; }

.kb-detail__related { }
.kb-detail__related-title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 10px;
}
.kb-detail__related-link {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s;
}
.kb-detail__related-link svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #94a3b8;
}
.kb-detail__related-link:hover {
    background: white;
    color: #2563eb;
}

.kb-detail__help {
    margin-top: auto;
    padding: 16px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    text-align: center;
}
.kb-detail__help p {
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    margin-bottom: 10px;
}
.kb-detail__help-btn {
    display: inline-block;
    padding: 7px 16px;
    background: #2563eb;
    color: white;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}
.kb-detail__help-btn:hover {
    background: #1d4ed8;
}

/* Content area */
.kb-detail__content {
    flex: 1;
    max-width: 760px;
    padding: 32px 48px 80px;
}

/* Breadcrumb */
.kb-detail__breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #94a3b8;
    margin-bottom: 28px;
}
.kb-detail__breadcrumb a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s;
}
.kb-detail__breadcrumb a:hover { color: #2563eb; }
.kb-detail__breadcrumb span { color: #94a3b8; }
.kb-detail__breadcrumb svg { opacity: 0.4; }

/* Header */
.kb-detail__header {
    margin-bottom: 36px;
    padding-bottom: 28px;
    border-bottom: 1px solid #f1f5f9;
}
.kb-detail__cat {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 14px;
}
.kb-detail__title {
    font-family: 'Bricolage Grotesque', var(--font-sans);
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--color-text);
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}
.kb-detail__lead {
    font-size: 1.05rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}
.kb-detail__meta {
    display: flex;
    gap: 20px;
    font-size: 0.78rem;
    color: #94a3b8;
}
.kb-detail__meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.kb-detail__meta svg { opacity: 0.6; }

/* Prose (article body) */
.kb-prose {
    font-size: 0.95rem;
    line-height: 1.85;
    color: #334155;
}
.kb-prose p { margin-bottom: 18px; }
.kb-prose h2 {
    font-family: 'Bricolage Grotesque', var(--font-sans);
    font-size: 1.3rem;
    font-weight: 700;
    margin: 40px 0 14px;
    color: var(--color-text);
    letter-spacing: -0.01em;
}
.kb-prose h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 28px 0 10px;
    color: var(--color-text);
}
.kb-prose strong { color: var(--color-text); }
.kb-prose a {
    color: #2563eb;
    text-decoration: underline;
    text-decoration-color: rgba(37, 99, 235, 0.3);
    text-underline-offset: 2px;
}
.kb-prose a:hover {
    text-decoration-color: #2563eb;
}
.kb-prose code {
    padding: 2px 7px;
    background: #f1f5f9;
    border-radius: 5px;
    font-size: 0.86em;
    font-family: 'JetBrains Mono', var(--font-mono, monospace);
    color: #1e293b;
}
.kb-prose pre {
    padding: 20px;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 12px;
    overflow-x: auto;
    margin: 20px 0;
    font-size: 0.84rem;
    line-height: 1.7;
}
.kb-prose pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}
.kb-prose ul, .kb-prose ol {
    margin: 16px 0;
    padding-left: 24px;
}
.kb-prose li {
    margin-bottom: 8px;
    padding-left: 4px;
}
.kb-prose li::marker {
    color: #94a3b8;
}
.kb-prose blockquote {
    border-left: 3px solid #2563eb;
    margin: 20px 0;
    padding: 12px 20px;
    background: #f8fafc;
    border-radius: 0 8px 8px 0;
    color: #475569;
    font-style: italic;
}
.kb-prose img {
    max-width: 100%;
    border-radius: 10px;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.kb-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.88rem;
}
.kb-prose th {
    text-align: left;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: var(--color-text);
}
.kb-prose td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
}

/* Feedback */
.kb-feedback {
    margin-top: 48px;
    padding: 24px;
    background: #f8fafc;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    text-align: center;
}
.kb-feedback__question {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 14px;
}
.kb-feedback__actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.kb-feedback__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    color: var(--color-text-secondary);
}
.kb-feedback__btn:hover {
    border-color: #cbd5e1;
}
.kb-feedback__btn--yes:hover {
    border-color: #86efac;
    background: #ecfdf5;
    color: #059669;
}
.kb-feedback__btn--no:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: #dc2626;
}
.kb-feedback__thanks {
    font-size: 0.88rem;
    color: #059669;
    font-weight: 500;
}

/* Article lock (requires login) */
.kb-prose--blurred {
    position: relative;
    max-height: 180px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, black 30%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 30%, transparent 100%);
}
.kb-lock {
    margin-top: -20px;
    margin-bottom: 32px;
}
.kb-lock__inner {
    text-align: center;
    padding: 40px 32px;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    border: 2px solid #dbeafe;
    border-radius: 20px;
}
.kb-lock__inner svg { margin-bottom: 12px; }
.kb-lock__inner h3 {
    font-family: 'Bricolage Grotesque', var(--font-sans);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-text);
}
.kb-lock__inner p {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}
.kb-lock__actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.kb-lock__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
}
.kb-lock__btn--primary {
    background: #2563eb;
    color: white;
}
.kb-lock__btn--primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.kb-lock__btn--ghost {
    background: white;
    color: #2563eb;
    border: 1px solid #dbeafe;
}
.kb-lock__btn--ghost:hover {
    border-color: #2563eb;
    background: #f8fafc;
}

/* Lock indicator on article cards */
.kb-article__lock {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    color: #f59e0b;
    font-weight: 600;
}

/* Mobile */
@media (max-width: 768px) {
    .kb-hero { padding: 40px 16px 36px; }
    .kb-hero__title { font-size: 1.6rem; }
    .kb-search { flex-direction: column; }
    .kb-search__input { padding: 14px 14px 14px 44px; }
    .kb-search__btn { margin: 0 6px 6px; }
    .kb-categories { grid-template-columns: 1fr; }
    .kb-detail { flex-direction: column; }
    .kb-detail__sidebar {
        width: 100%;
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
        padding: 16px;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    .kb-detail__related { display: none; }
    .kb-detail__help { margin-top: 0; }
    .kb-detail__content { padding: 24px 16px 60px; }
    .kb-detail__title { font-size: 1.4rem; }
    .kb-lock__inner { padding: 28px 20px; }
}

/* ===== Canned Template Dropdown ===== */
.hd-tmpl-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    width: 260px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg, 0 10px 25px rgba(0,0,0,0.1));
    z-index: 100;
    padding: 6px;
}
.hd-tmpl-menu.hd-tmpl-open { display: block; }
.hd-tmpl-cat {
    padding: 6px 10px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
}
.hd-tmpl-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-text);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s;
}
.hd-tmpl-item:hover {
    background: var(--color-bg);
    color: var(--color-primary);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .hd { flex-direction: column; min-height: auto; }
    .hd-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    .hd-list { max-height: 50vh; }
    .hd-welcome { display: none; }
    .hd-chat { padding: 20px; }
    .hd-inputbar { padding: 12px 20px 16px; }
    .hd-form { padding: 24px; }
    .hd-form__row--half { grid-template-columns: 1fr; }
    .hd-form__actions { flex-direction: column-reverse; gap: 12px; }
    .hd-form__submit { width: 100%; }
}

@media (max-width: 640px) {
    .hd { margin-top: 64px; }
    .hd-sidebar__head { padding: 16px 20px; }
    .hd-filters { padding: 10px 20px; overflow-x: auto; }
    .hd-item { padding: 14px 20px; }
    .hd-msg { gap: 8px; max-width: 90%; }
    .hd-msg__avatar { width: 28px; height: 28px; font-size: 0.7rem; }
    .hd-msg__body { padding: 12px 14px; font-size: 0.85rem; }
    .hd-detail-info { padding: 20px; }
    .hd-chat { padding: 16px; }
}

/* ===== UX Enhancements ===== */

/* Loading state for submit buttons */
.hd-form__submit.btn-loading,
.hd-inputbar__send.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}
.hd-form__submit.btn-loading::after,
.hd-inputbar__send.btn-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hd-spin 0.6s linear infinite;
}
@keyframes hd-spin { to { transform: rotate(360deg); } }

/* Better resolution stars on hover */
.hd-resolve__stars label { transition: color 0.1s; }

/* Pagination for ticket list */
.hd-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 24px;
    border-top: 1px solid var(--color-border);
}
.hd-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: background 0.15s;
}
.hd-pagination a:hover { background: var(--color-bg); color: var(--color-primary); }
.hd-pagination a.active { background: var(--color-primary); color: #fff; }
.hd-pagination a.disabled { opacity: 0.4; pointer-events: none; }

/* Improved mobile sidebar */
@media (max-width: 640px) {
    .hd-sidebar { max-height: 40vh; overflow: hidden; }
    .hd-sidebar.hd-sidebar--expanded { max-height: none; }
    .hd-sidebar__toggle-list {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        font-size: 0.8rem;
        color: var(--color-primary);
        background: var(--color-bg);
        border: none;
        cursor: pointer;
        width: 100%;
        font-weight: 500;
        border-top: 1px solid var(--color-border);
    }
}

/* KB article table of contents */
.kb-toc {
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin-bottom: 24px;
}
.kb-toc__title {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: 10px;
}
.kb-toc__list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.kb-toc__list li {
    margin-bottom: 6px;
}
.kb-toc__list a {
    font-size: 0.88rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    transition: color 0.15s;
}
.kb-toc__list a:hover { color: var(--color-primary); }
.kb-toc__list a::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-border);
    flex-shrink: 0;
}

/* KB search improvements */
.kb-search__count {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    padding: 8px 16px;
    border-bottom: 1px solid var(--color-border);
}

/* Better feedback button states */
.kb-feedback__btn.kb-feedback__btn--voted {
    pointer-events: none;
    opacity: 0.6;
}

/* Print styles for KB articles */
@media print {
    .hd-sidebar, .hd-inputbar, .kb-toc, .hd-detail-info { display: none; }
    .hd { display: block; margin: 0; }
    .hd-main { width: 100%; }
    .kb-detail { box-shadow: none; border: none; }
}
