/* =================================================================
 * HK-Crawl Design System
 * Based on UI Component Library (Notion-style)
 *
 * Nguon: Trich xuat tu cac example.html trong
 *        .claude/skills/ui-component-library/components/
 * ================================================================= */

/* === 1. Design Tokens === */

:root {
    /* Text */
    --hk-text-primary: #37352f;
    --hk-text-secondary: rgba(55, 53, 47, 0.65);
    --hk-text-muted: rgba(55, 53, 47, 0.5);
    --hk-text-hint: rgba(55, 53, 47, 0.35);

    /* Background */
    --hk-bg-page: #ffffff;
    --hk-bg-surface: #ffffff;
    --hk-bg-surface-raised: #ffffff;
    --hk-bg-hover: rgba(55, 53, 47, 0.08);
    --hk-bg-active: rgba(55, 53, 47, 0.16);
    --hk-bg-selected: rgba(35, 131, 226, 0.08);

    /* Border */
    --hk-border-light: rgba(55, 53, 47, 0.09);
    --hk-border-default: rgba(55, 53, 47, 0.16);
    --hk-border-strong: rgba(55, 53, 47, 0.3);

    /* Icon */
    --hk-icon-default: rgba(55, 53, 47, 0.45);
    --hk-icon-muted: rgba(55, 53, 47, 0.3);

    /* Semantic */
    --hk-color-primary: #4f46e5;
    --hk-color-success: #059669;
    --hk-color-danger: #dc2626;
    --hk-color-warning: #d97706;
    --hk-color-info: #0891b2;

    /* Avatar */
    --hk-avatar-bg: #e3e2e0;
    --hk-avatar-text: rgba(55, 53, 47, 0.65);

    /* Radius */
    --hk-radius-sm: 4px;
    --hk-radius-md: 6px;
    --hk-radius-lg: 8px;
    --hk-radius-xl: 12px;
    --hk-radius-full: 9999px;

    /* Shadow */
    --hk-shadow-card: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px;
    --hk-shadow-sm: rgba(15,15,15,0.05) 0px 0px 0px 1px, rgba(15,15,15,0.1) 0px 3px 6px, rgba(15,15,15,0.2) 0px 9px 24px;
    --hk-shadow-md: rgba(15,15,15,0.05) 0px 0px 0px 1px, rgba(15,15,15,0.1) 0px 5px 10px, rgba(15,15,15,0.2) 0px 15px 40px;

    /* Typography */
    --hk-font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif;

    /* Button tokens */
    --hk-btn-text: #37352f;
    --hk-btn-bg-hover: rgba(55, 53, 47, 0.08);
    --hk-btn-bg-active: rgba(55, 53, 47, 0.16);
    --hk-btn-border: rgba(55, 53, 47, 0.16);
    --hk-btn-primary: #4f46e5;
    --hk-btn-primary-hover: #4338ca;
    --hk-btn-primary-active: #3730a3;
    --hk-btn-danger: #dc2626;
    --hk-btn-danger-hover: #b91c1c;
    --hk-btn-danger-active: #991b1b;

    /* Input tokens */
    --hk-input-text: #37352f;
    --hk-input-placeholder: rgba(55, 53, 47, 0.5);
    --hk-input-bg: transparent;
    --hk-input-hover-bg: rgba(55, 53, 47, 0.08);
    --hk-input-border: rgba(55, 53, 47, 0.16);
    --hk-input-border-hover: rgba(55, 53, 47, 0.3);
    --hk-input-error-border: #eb5757;
    --hk-input-error-text: #eb5757;
    --hk-input-helper-color: rgba(55, 53, 47, 0.5);
    --hk-input-icon-color: rgba(55, 53, 47, 0.45);
    --hk-input-font-size: 14px;
    --hk-input-line-height: 1.5;
    --hk-input-padding: 4px 8px;
    --hk-input-border-radius: 4px;
    --hk-input-min-height: 28px;
    --hk-input-title-font-size: 40px;
    --hk-input-title-font-weight: 700;
    --hk-input-title-line-height: 1.2;

    /* Table tokens */
    --hk-table-bg: transparent;
    --hk-table-header-bg: rgba(55, 53, 47, 0.03);
    --hk-table-header-text: rgba(55, 53, 47, 0.5);
    --hk-table-header-font-size: 12px;
    --hk-table-header-font-weight: 500;
    --hk-table-header-height: 34px;
    --hk-table-row-bg: transparent;
    --hk-table-row-hover-bg: rgba(55, 53, 47, 0.04);
    --hk-table-row-selected-bg: rgba(35, 131, 226, 0.08);
    --hk-table-row-height: 36px;
    --hk-table-cell-padding: 6px 8px;
    --hk-table-cell-text: #37352f;
    --hk-table-cell-font-size: 14px;
    --hk-table-cell-font-weight: 400;
    --hk-table-border: rgba(55, 53, 47, 0.09);
    --hk-table-border-strong: rgba(55, 53, 47, 0.16);
    --hk-table-sort-icon-color: rgba(55, 53, 47, 0.35);
    --hk-table-add-row-color: rgba(55, 53, 47, 0.5);
    --hk-table-empty-color: rgba(55, 53, 47, 0.5);
    --hk-table-stripe-bg: rgba(55, 53, 47, 0.02);

    /* Sidebar tokens */
    --hk-sidebar-width: 260px;
    --hk-sidebar-width-collapsed: 48px;
    --hk-sidebar-bg: var(--hk-bg-surface);
    --hk-sidebar-border: var(--hk-border-light);
    --hk-sidebar-item-padding: 6px 12px;
    --hk-sidebar-item-radius: 6px;
    --hk-sidebar-item-gap: 8px;
    --hk-sidebar-item-height: 30px;
    --hk-sidebar-item-text-color: var(--hk-text-primary);
    --hk-sidebar-item-text-size: 14px;
    --hk-sidebar-item-text-weight: 400;
    --hk-sidebar-item-icon-color: var(--hk-icon-default);
    --hk-sidebar-item-icon-size: 20px;
    --hk-sidebar-item-hover-bg: var(--hk-bg-hover);
    --hk-sidebar-item-active-bg: var(--hk-bg-active);
    --hk-sidebar-item-value-color: var(--hk-text-muted);
    --hk-sidebar-item-value-size: 12px;
    --hk-sidebar-section-label-color: var(--hk-text-muted);
    --hk-sidebar-section-label-size: 11px;
    --hk-sidebar-section-label-weight: 500;
    --hk-sidebar-divider-color: var(--hk-border-light);
    --hk-sidebar-header-padding: 12px 8px;
    --hk-sidebar-footer-padding: 8px 8px;

    /* Badge tokens */
    --hk-badge-status-dot-size: 6px;
    --hk-badge-count-size: 18px;
    --hk-badge-count-font-size: 11px;
    --hk-badge-count-font-weight: 600;
    --hk-badge-sm-height: 20px;
    --hk-badge-md-height: 24px;
    --hk-badge-status-padding: 2px 6px;
    --hk-badge-pill-padding: 2px 8px;
    --hk-tag-padding: 0 8px;
    --hk-tag-height: 24px;
    --hk-tag-border-radius: 4px;
    --hk-tag-font-size: 12px;
    --hk-tag-font-weight: 400;
    --hk-badge-pill-border-radius: 9999px;
    --hk-badge-remove-icon-size: 14px;

    /* Badge color variants */
    --hk-badge-success-bg: rgba(5, 150, 105, 0.1);
    --hk-badge-success-text: #047857;
    --hk-badge-success-dot: #059669;
    --hk-badge-warning-bg: rgba(217, 119, 6, 0.1);
    --hk-badge-warning-text: #b45309;
    --hk-badge-warning-dot: #d97706;
    --hk-badge-danger-bg: rgba(220, 38, 38, 0.1);
    --hk-badge-danger-text: #b91c1c;
    --hk-badge-danger-dot: #dc2626;
    --hk-badge-info-bg: rgba(8, 145, 178, 0.1);
    --hk-badge-info-text: #0e7490;
    --hk-badge-info-dot: #0891b2;
    --hk-badge-neutral-bg: rgba(55, 53, 47, 0.08);
    --hk-badge-neutral-text: rgba(55, 53, 47, 0.5);
    --hk-badge-neutral-dot: rgba(55, 53, 47, 0.3);
    --hk-badge-primary-bg: rgba(79, 70, 229, 0.1);
    --hk-badge-primary-text: #4338ca;
    --hk-badge-primary-dot: #4f46e5;

    /* Tag color palette */
    --hk-tag-blush-bg: #f7d5ce;
    --hk-tag-blush-text: #a53b1c;
    --hk-tag-coral-bg: #fce1da;
    --hk-tag-coral-text: #b45309;
    --hk-tag-lightblue-bg: #d7ebf7;
    --hk-tag-lightblue-text: #0e7490;
    --hk-tag-rose-bg: #fdd7dc;
    --hk-tag-rose-text: #9f1239;
    --hk-tag-beige-bg: #e8d5c4;
    --hk-tag-beige-text: #7c2d12;
    --hk-tag-gray-bg: #e5e5e5;
    --hk-tag-gray-text: #525252;

    /* Form layout tokens */
    --hk-form-label-color: rgba(55, 53, 47, 0.65);
    --hk-form-label-font-size: 13px;
    --hk-form-label-font-weight: 500;
    --hk-form-helper-color: rgba(55, 53, 47, 0.5);
    --hk-form-helper-font-size: 12px;
    --hk-form-error-color: #dc2626;
    --hk-form-success-color: #059669;
    --hk-form-required-color: #dc2626;
    --hk-form-divider: rgba(55, 53, 47, 0.09);
    --hk-form-section-gap: 24px;
    --hk-form-group-gap: 16px;

    /* Alert tokens */
    --hk-alert-info-bg: rgba(2, 132, 199, 0.1);
    --hk-alert-info-border: #0891b2;
    --hk-alert-info-text: #0891b2;
    --hk-alert-success-bg: rgba(5, 150, 105, 0.1);
    --hk-alert-success-border: #059669;
    --hk-alert-success-text: #059669;
    --hk-alert-warning-bg: rgba(217, 119, 6, 0.1);
    --hk-alert-warning-border: #d97706;
    --hk-alert-warning-text: #d97706;
    --hk-alert-danger-bg: rgba(220, 38, 38, 0.1);
    --hk-alert-danger-border: #dc2626;
    --hk-alert-danger-text: #dc2626;
    --hk-alert-padding: 12px 16px;
    --hk-alert-padding-inline: 8px 12px;
    --hk-alert-border-radius: 6px;
    --hk-alert-icon-size: 20px;
    --hk-alert-gap: 12px;
}

/* Dark mode tokens */
[data-theme="dark"] {
    /* Text */
    --hk-text-primary: rgba(255, 255, 255, 0.81);
    --hk-text-secondary: rgba(255, 255, 255, 0.55);
    --hk-text-muted: rgba(255, 255, 255, 0.4);
    --hk-text-hint: rgba(255, 255, 255, 0.28);

    /* Background */
    --hk-bg-page: #191919;
    --hk-bg-surface: #202020;
    --hk-bg-surface-raised: #2f2f2f;
    --hk-bg-hover: rgba(255, 255, 255, 0.08);
    --hk-bg-active: rgba(255, 255, 255, 0.16);
    --hk-bg-selected: rgba(35, 131, 226, 0.15);

    /* Border */
    --hk-border-light: rgba(255, 255, 255, 0.07);
    --hk-border-default: rgba(255, 255, 255, 0.13);
    --hk-border-strong: rgba(255, 255, 255, 0.25);

    /* Icon */
    --hk-icon-default: rgba(255, 255, 255, 0.35);
    --hk-icon-muted: rgba(255, 255, 255, 0.25);

    /* Avatar */
    --hk-avatar-bg: rgba(255, 255, 255, 0.13);
    --hk-avatar-text: rgba(255, 255, 255, 0.55);

    /* Shadow */
    --hk-shadow-card: rgba(255, 255, 255, 0.07) 0px 0px 0px 1px;
    --hk-shadow-sm: rgba(15,15,15,0.1) 0px 0px 0px 1px, rgba(15,15,15,0.2) 0px 3px 6px, rgba(15,15,15,0.4) 0px 9px 24px;
    --hk-shadow-md: rgba(15,15,15,0.1) 0px 0px 0px 1px, rgba(15,15,15,0.2) 0px 5px 10px, rgba(15,15,15,0.4) 0px 15px 40px;

    /* Button tokens */
    --hk-btn-text: rgba(255, 255, 255, 0.81);
    --hk-btn-bg-hover: rgba(255, 255, 255, 0.08);
    --hk-btn-bg-active: rgba(255, 255, 255, 0.16);
    --hk-btn-border: rgba(255, 255, 255, 0.13);

    /* Input tokens */
    --hk-input-text: rgba(255, 255, 255, 0.81);
    --hk-input-placeholder: rgba(255, 255, 255, 0.4);
    --hk-input-hover-bg: rgba(255, 255, 255, 0.08);
    --hk-input-border: rgba(255, 255, 255, 0.13);
    --hk-input-border-hover: rgba(255, 255, 255, 0.25);
    --hk-input-helper-color: rgba(255, 255, 255, 0.4);
    --hk-input-icon-color: rgba(255, 255, 255, 0.35);

    /* Table tokens */
    --hk-table-header-bg: rgba(255, 255, 255, 0.03);
    --hk-table-header-text: rgba(255, 255, 255, 0.4);
    --hk-table-row-hover-bg: rgba(255, 255, 255, 0.04);
    --hk-table-row-selected-bg: rgba(35, 131, 226, 0.15);
    --hk-table-cell-text: rgba(255, 255, 255, 0.81);
    --hk-table-border: rgba(255, 255, 255, 0.07);
    --hk-table-border-strong: rgba(255, 255, 255, 0.13);
    --hk-table-sort-icon-color: rgba(255, 255, 255, 0.28);
    --hk-table-add-row-color: rgba(255, 255, 255, 0.4);
    --hk-table-empty-color: rgba(255, 255, 255, 0.4);
    --hk-table-stripe-bg: rgba(255, 255, 255, 0.02);

    /* Badge tokens */
    --hk-badge-success-bg: rgba(5, 150, 105, 0.15);
    --hk-badge-success-text: #5eead4;
    --hk-badge-success-dot: #10b981;
    --hk-badge-warning-bg: rgba(217, 119, 6, 0.15);
    --hk-badge-warning-text: #fbbf24;
    --hk-badge-warning-dot: #f59e0b;
    --hk-badge-danger-bg: rgba(220, 38, 38, 0.15);
    --hk-badge-danger-text: #f87171;
    --hk-badge-danger-dot: #ef4444;
    --hk-badge-info-bg: rgba(8, 145, 178, 0.15);
    --hk-badge-info-text: #67e8f9;
    --hk-badge-info-dot: #06b6d4;
    --hk-badge-neutral-bg: rgba(255, 255, 255, 0.08);
    --hk-badge-neutral-text: rgba(255, 255, 255, 0.4);
    --hk-badge-neutral-dot: rgba(255, 255, 255, 0.25);
    --hk-badge-primary-bg: rgba(79, 70, 229, 0.15);
    --hk-badge-primary-text: #a5b4fc;
    --hk-badge-primary-dot: #818cf8;

    /* Tag color palette */
    --hk-tag-blush-bg: #7c2d12;
    --hk-tag-blush-text: #fdba74;
    --hk-tag-coral-bg: #7c2d12;
    --hk-tag-coral-text: #fbbf24;
    --hk-tag-lightblue-bg: #0e7490;
    --hk-tag-lightblue-text: #67e8f9;
    --hk-tag-rose-bg: #831843;
    --hk-tag-rose-text: #fbcfe8;
    --hk-tag-beige-bg: #7c2d12;
    --hk-tag-beige-text: #fed7aa;
    --hk-tag-gray-bg: #404040;
    --hk-tag-gray-text: #e5e7eb;

    /* Form layout tokens */
    --hk-form-label-color: rgba(255, 255, 255, 0.55);
    --hk-form-helper-color: rgba(255, 255, 255, 0.4);

    /* Alert tokens */
    --hk-alert-info-bg: rgba(2, 132, 199, 0.2);
    --hk-alert-info-border: #0891b2;
    --hk-alert-info-text: #0891b2;
    --hk-alert-success-bg: rgba(5, 150, 105, 0.2);
    --hk-alert-success-border: #059669;
    --hk-alert-success-text: #059669;
    --hk-alert-warning-bg: rgba(217, 119, 6, 0.2);
    --hk-alert-warning-border: #d97706;
    --hk-alert-warning-text: #d97706;
    --hk-alert-danger-bg: rgba(220, 38, 38, 0.2);
    --hk-alert-danger-border: #dc2626;
    --hk-alert-danger-text: #dc2626;
}


/* === 2. Base Resets === */

* {
    box-sizing: border-box;
}

body {
    font-family: var(--hk-font-family);
    font-size: 14px;
    line-height: 1.5;
    background: var(--hk-bg-page);
    color: var(--hk-text-primary);
    margin: 0;
    padding: 0;
    transition: background 0.2s, color 0.2s;
}

/* Focus glow reset -- KHONG cho bat ky element nao co glow khi focus */
*:focus {
    outline: none !important;
}

.form-control:focus,
.form-select:focus,
.btn:focus,
.form-check-input:focus,
input:focus,
select:focus,
textarea:focus {
    box-shadow: none !important;
    outline: none !important;
}


/* === 3. Sidebar === */

.hk-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--hk-sidebar-width);
    background: var(--hk-sidebar-bg);
    border-right: 1px solid var(--hk-sidebar-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1030;
}

/* Header */
.hk-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--hk-sidebar-header-padding);
    flex-shrink: 0;
}

.hk-sidebar__header-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--hk-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hk-sidebar__header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: var(--hk-radius-sm);
    background: transparent;
    color: var(--hk-icon-default);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.hk-sidebar__header-action:hover {
    background: var(--hk-bg-hover);
}

.hk-sidebar__header-action .material-symbols-rounded {
    font-size: 18px;
}

/* Nav */
.hk-sidebar__nav {
    flex: 1;
    padding: 4px 8px;
    overflow-y: auto;
}

/* Section */
.hk-sidebar__section {
    margin-bottom: 2px;
}

/* Section label */
.hk-sidebar__section-label {
    font-size: var(--hk-sidebar-section-label-size);
    font-weight: var(--hk-sidebar-section-label-weight);
    color: var(--hk-sidebar-section-label-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 6px 12px 4px;
    user-select: none;
}

/* Menu item */
.hk-sidebar__item {
    display: flex;
    align-items: center;
    gap: var(--hk-sidebar-item-gap);
    padding: var(--hk-sidebar-item-padding);
    min-height: var(--hk-sidebar-item-height);
    border-radius: var(--hk-sidebar-item-radius);
    color: var(--hk-sidebar-item-text-color);
    font-size: var(--hk-sidebar-item-text-size);
    font-weight: var(--hk-sidebar-item-text-weight);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.1s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
    line-height: 1.3;
}

.hk-sidebar__item:hover {
    background: var(--hk-sidebar-item-hover-bg);
}

/* Active item */
.hk-sidebar__item--active {
    background: var(--hk-sidebar-item-active-bg);
}

.hk-sidebar__item--active:hover {
    background: var(--hk-sidebar-item-active-bg);
}

/* Item icon */
.hk-sidebar__item-icon {
    flex-shrink: 0;
    font-size: var(--hk-sidebar-item-icon-size);
    color: var(--hk-sidebar-item-icon-color);
    display: inline-flex;
    align-items: center;
}

/* Item text */
.hk-sidebar__item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Item value (ben phai) */
.hk-sidebar__item-value {
    font-size: var(--hk-sidebar-item-value-size);
    color: var(--hk-sidebar-item-value-color);
    flex-shrink: 0;
    white-space: nowrap;
}

/* Item badge */
.hk-sidebar__item-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9999px;
    background: rgba(35, 131, 226, 0.1);
    color: #2383e2;
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
    line-height: 1;
}

/* Item arrow */
.hk-sidebar__item-arrow {
    font-size: 16px;
    color: var(--hk-text-hint);
    flex-shrink: 0;
}

/* Divider */
.hk-sidebar__divider {
    height: 1px;
    background: var(--hk-sidebar-divider-color);
    margin: 4px 8px;
}

/* Footer */
.hk-sidebar__footer {
    border-top: 1px solid var(--hk-sidebar-divider-color);
    padding: var(--hk-sidebar-footer-padding);
    flex-shrink: 0;
}

/* Expandable group */
.hk-sidebar__group-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    min-height: 30px;
    border-radius: var(--hk-sidebar-item-radius);
    cursor: pointer;
    width: 100%;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    color: var(--hk-text-primary);
    transition: background 0.1s ease;
    text-align: left;
}

.hk-sidebar__group-header:hover {
    background: var(--hk-bg-hover);
}

.hk-sidebar__group-header .hk-sidebar__item-icon {
    font-size: 16px;
    color: var(--hk-text-hint);
    transition: transform 0.15s ease;
}

.hk-sidebar__group--expanded .hk-sidebar__group-header .hk-sidebar__item-icon {
    transform: rotate(90deg);
}

.hk-sidebar__group-children {
    padding-left: 12px;
    display: none;
}

.hk-sidebar__group--expanded .hk-sidebar__group-children {
    display: block;
}

/* Compact variant (collapsed, chi icon) */
.hk-sidebar--compact {
    width: var(--hk-sidebar-width-collapsed);
}

.hk-sidebar--compact .hk-sidebar__item {
    justify-content: center;
    padding: 8px;
}

.hk-sidebar--compact .hk-sidebar__item-text,
.hk-sidebar--compact .hk-sidebar__item-value,
.hk-sidebar--compact .hk-sidebar__item-badge,
.hk-sidebar--compact .hk-sidebar__item-arrow,
.hk-sidebar--compact .hk-sidebar__header-title,
.hk-sidebar--compact .hk-sidebar__section-label {
    display: none;
}

.hk-sidebar--compact .hk-sidebar__header {
    justify-content: center;
    padding: 12px 4px;
}

/* Panel variant (khong border-right, bg transparent) */
.hk-sidebar--panel {
    border-right: none;
    background: transparent;
}

/* User avatar trong footer */
.hk-sidebar__user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--hk-sidebar-item-radius);
    cursor: pointer;
    transition: background 0.1s ease;
}

.hk-sidebar__user:hover {
    background: var(--hk-bg-hover);
}

.hk-sidebar__user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background: #e3e2e0;
    color: rgba(55, 53, 47, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
}

[data-theme="dark"] .hk-sidebar__user-avatar {
    background: rgba(255, 255, 255, 0.13);
    color: rgba(255, 255, 255, 0.55);
}

.hk-sidebar__user-info {
    flex: 1;
    overflow: hidden;
}

.hk-sidebar__user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--hk-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hk-sidebar__user-email {
    font-size: 11px;
    color: var(--hk-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* === 4. Header/Topbar === */

.hk-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    padding: 0 16px;
    background: var(--hk-bg-surface);
    border-bottom: 1px solid var(--hk-border-light);
    display: flex;
    align-items: center;
    z-index: 1000;
}

.hk-header__left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.hk-header__logo {
    font-size: 16px;
    font-weight: 600;
    color: var(--hk-text-primary);
    white-space: nowrap;
}

.hk-header__center {
    flex: 1;
    margin: 0 24px;
    max-width: 480px;
}

.hk-header__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.hk-header__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--hk-radius-md);
    background: transparent;
    color: var(--hk-icon-default);
    cursor: pointer;
    transition: background 0.1s ease;
    padding: 0;
}

.hk-header__icon-btn:hover {
    background: var(--hk-bg-hover);
}

.hk-header__icon-btn:focus {
    outline: none;
    box-shadow: none;
}

.hk-header__icon-btn .material-symbols-rounded {
    font-size: 20px;
}

/* Notification Badge */
.hk-header__notification {
    position: relative;
}

.hk-header__notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 8px;
    height: 8px;
    background: #dc2626;
    border-radius: 50%;
    border: 2px solid var(--hk-bg-surface);
}

/* User Menu */
.hk-header__user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: var(--hk-radius-md);
    transition: background 0.1s ease;
    position: relative;
}

.hk-header__user:hover {
    background: var(--hk-bg-hover);
}

.hk-header__user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--hk-color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.hk-header__user-name {
    font-size: 13px;
    font-weight: 400;
    color: var(--hk-text-primary);
    display: none;
}

@media (min-width: 768px) {
    .hk-header__user-name {
        display: inline;
    }
}

.hk-header__user-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--hk-bg-surface);
    border: 1px solid var(--hk-border-light);
    border-radius: var(--hk-radius-md);
    box-shadow: var(--hk-shadow-card);
    min-width: 200px;
    margin-top: 8px;
    z-index: 10;
}

.hk-header__user-menu.open {
    display: flex;
    flex-direction: column;
}

.hk-header__user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--hk-text-primary);
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    width: 100%;
    transition: background 0.1s ease;
}

.hk-header__user-menu-item:hover {
    background: var(--hk-bg-hover);
}

.hk-header__user-menu-divider {
    height: 1px;
    background: var(--hk-border-light);
    margin: 4px 0;
}

/* Search Input in header */
.hk-header__search {
    width: 100%;
    padding: 6px 12px;
    border: 1px solid var(--hk-border-light);
    border-radius: var(--hk-radius-sm);
    background: var(--hk-bg-page);
    color: var(--hk-text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hk-header__search input {
    flex: 1;
    border: none;
    background: none;
    color: var(--hk-text-primary);
    font-size: 14px;
}

.hk-header__search input:focus {
    outline: none;
}

.hk-header__search input::placeholder {
    color: var(--hk-text-hint);
}


/* === 5. Table === */

.hk-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background: var(--hk-table-bg);
    font-size: var(--hk-table-cell-font-size);
}

/* Header */
.hk-table__head {
    background: var(--hk-table-header-bg);
}

.hk-table__th {
    padding: var(--hk-table-cell-padding);
    height: var(--hk-table-header-height);
    font-size: var(--hk-table-header-font-size);
    font-weight: var(--hk-table-header-font-weight);
    color: var(--hk-table-header-text);
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    border-bottom: 1px solid var(--hk-table-border-strong);
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    position: relative;
}

/* Header sortable */
.hk-table__th--sortable {
    cursor: pointer;
}

.hk-table__th--sortable:hover {
    background: var(--hk-bg-hover);
}

/* Sort icon */
.hk-table__sort-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    color: var(--hk-table-sort-icon-color);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.1s;
    vertical-align: middle;
}

.hk-table__th--sortable:hover .hk-table__sort-icon,
.hk-table__th--sorting .hk-table__sort-icon {
    opacity: 1;
}

.hk-table__th--sorting {
    background: var(--hk-bg-hover);
}

/* Body */
.hk-table__row {
    border-bottom: 1px solid var(--hk-table-border);
    transition: background 0.1s ease;
}

.hk-table__row:hover {
    background: var(--hk-table-row-hover-bg);
}

.hk-table__row:last-child {
    border-bottom: 1px solid var(--hk-table-border);
}

.hk-table__td {
    padding: var(--hk-table-cell-padding);
    height: var(--hk-table-row-height);
    font-size: var(--hk-table-cell-font-size);
    font-weight: var(--hk-table-cell-font-weight);
    color: var(--hk-table-cell-text);
    vertical-align: middle;
}

/* Row states */
.hk-table__row--selected {
    background: var(--hk-table-row-selected-bg);
}

.hk-table__row--selected:hover {
    background: var(--hk-table-row-selected-bg);
}

/* Add row */
.hk-table__add-row {
    border-bottom: none;
    cursor: pointer;
    transition: background 0.1s ease;
}

.hk-table__add-row:hover {
    background: var(--hk-table-row-hover-bg);
}

.hk-table__add-row td {
    padding: var(--hk-table-cell-padding);
    height: var(--hk-table-row-height);
    color: var(--hk-table-add-row-color);
    font-size: 14px;
    font-weight: 400;
}

/* Empty state */
.hk-table__empty {
    text-align: center;
    color: var(--hk-table-empty-color);
    padding: 32px !important;
    font-size: 14px;
}

/* Checkbox column */
.hk-table__th--checkbox,
.hk-table__td--checkbox {
    width: 36px;
    text-align: center;
    padding: 0 !important;
}

.hk-table__checkbox {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    cursor: pointer;
    accent-color: #2383e2;
}

/* Metadata cell */
.hk-table__td--meta {
    font-size: 12px;
    color: var(--hk-text-secondary);
}

/* Variant: Bordered */
.hk-table--bordered .hk-table__th,
.hk-table--bordered .hk-table__td {
    border-right: 1px solid var(--hk-table-border);
    border-bottom: 1px solid var(--hk-table-border);
}

.hk-table--bordered .hk-table__th {
    border-bottom: 1px solid var(--hk-table-border-strong);
}

.hk-table--bordered .hk-table__th:last-child,
.hk-table--bordered .hk-table__td:last-child {
    border-right: none;
}

/* Variant: Compact */
.hk-table--compact .hk-table__th {
    padding: 4px 6px;
    height: 28px;
    font-size: 11px;
}

.hk-table--compact .hk-table__td {
    padding: 4px 6px;
    height: 28px;
    font-size: 13px;
}

/* Variant: Striped */
.hk-table--striped .hk-table__row:nth-child(even) {
    background: var(--hk-table-stripe-bg);
}

.hk-table--striped .hk-table__row:nth-child(even):hover {
    background: var(--hk-table-row-hover-bg);
}


/* === 6. Input === */

/* Wrapper */
.notion-input {
    position: relative;
    display: flex;
    align-items: center;
    min-height: var(--hk-input-min-height);
    border-radius: var(--hk-input-border-radius);
    transition: background 0.1s, box-shadow 0.15s;
    gap: 4px;
}

/* Input field */
.notion-input__field,
.notion-input__field.form-control,
.notion-input__textarea,
.notion-input__textarea.form-control {
    width: 100%;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--hk-input-text);
    font-family: var(--hk-font-family);
    font-size: var(--hk-input-font-size);
    font-weight: 400;
    line-height: var(--hk-input-line-height);
    padding: var(--hk-input-padding);
    min-height: var(--hk-input-min-height);
    caret-color: var(--hk-input-text);
    border-radius: 0 !important;
}

.notion-input__field::placeholder,
.notion-input__textarea::placeholder {
    color: var(--hk-input-placeholder);
    font-weight: 400;
}

/* Reset tat ca trang thai focus/hover/active -- KHONG cho Bootstrap can thiep */
.notion-input__field:focus,
.notion-input__field:hover,
.notion-input__field:active,
.notion-input__field.form-control:focus,
.notion-input__field.form-control:hover,
.notion-input__field.form-control:active,
.notion-input__textarea:focus,
.notion-input__textarea.form-control:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-color: transparent !important;
}

/* Variant: Inline (mac dinh Notion-style) */
.notion-input--inline {
    background: var(--hk-input-bg);
}

.notion-input--inline:hover {
    background: var(--hk-input-hover-bg);
}

.notion-input--inline:focus-within {
    background: var(--hk-input-hover-bg);
}

/* Variant: Bordered */
.notion-input--bordered {
    background: var(--hk-input-bg);
    box-shadow: inset 0 0 0 1px var(--hk-input-border);
    min-height: 34px;
}

.notion-input--bordered .notion-input__field {
    padding: 6px 10px;
    min-height: 34px;
}

.notion-input--bordered:hover {
    box-shadow: inset 0 0 0 1px var(--hk-input-border-hover);
}

.notion-input--bordered:focus-within {
    box-shadow: inset 0 0 0 1px var(--hk-input-border-hover);
}

/* Variant: Title */
.notion-input--title {
    background: transparent;
    min-height: auto;
}

.notion-input--title .notion-input__field {
    font-size: var(--hk-input-title-font-size);
    font-weight: var(--hk-input-title-font-weight);
    line-height: var(--hk-input-title-line-height);
    padding: 3px 2px;
    min-height: auto;
}

.notion-input--title .notion-input__field::placeholder {
    color: var(--hk-input-placeholder);
    font-weight: var(--hk-input-title-font-weight);
}

.notion-input--title:hover {
    background: transparent;
}

.notion-input--title:focus-within {
    background: transparent;
    box-shadow: none;
}

/* Variant: Search */
.notion-input--search {
    background: var(--hk-input-bg);
    min-height: 34px;
}

.notion-input--search .notion-input__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 6px;
    color: var(--hk-input-icon-color);
    flex-shrink: 0;
    pointer-events: none;
}

.notion-input--search .notion-input__icon .material-symbols-rounded {
    font-size: 18px;
}

.notion-input--search .notion-input__field {
    padding: 6px 10px 6px 6px;
    min-height: 34px;
}

.notion-input--search:hover {
    background: var(--hk-input-hover-bg);
}

.notion-input--search:focus-within {
    background: var(--hk-input-hover-bg);
}

/* State: Error */
.notion-input--error {
    box-shadow: inset 0 0 0 1px var(--hk-input-error-border) !important;
}

.notion-input--error:focus-within {
    box-shadow: inset 0 0 0 1px var(--hk-input-error-border) !important;
}

/* State: Disabled */
.notion-input--disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Suffix */
.notion-input__suffix {
    display: flex;
    align-items: center;
    padding-right: 8px;
    color: var(--hk-input-placeholder);
    font-size: 13px;
    flex-shrink: 0;
    user-select: none;
}

/* Helper text */
.notion-input__helper {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 400;
    color: var(--hk-input-helper-color);
    padding: 0 2px;
}

.notion-input__helper--error {
    color: var(--hk-input-error-text);
}

/* Textarea variant */
.notion-input__textarea {
    min-height: 60px;
    resize: vertical;
}

/* Property row layout (giong Notion property panel) */
.property-row {
    display: flex;
    align-items: flex-start;
    min-height: 34px;
    padding: 4px 0;
    gap: 8px;
}

.property-row--center {
    align-items: center;
}

.property-label {
    font-size: 14px;
    font-weight: 400;
    color: var(--hk-text-muted);
    width: 120px;
    flex-shrink: 0;
    padding-top: 4px;
}

.property-row--center .property-label {
    padding-top: 0;
}

.property-value {
    flex: 1;
    min-width: 0;
}

/* Notion divider */
.notion-divider {
    height: 1px;
    background: rgba(55, 53, 47, 0.09);
    margin: 16px 0;
}

[data-theme="dark"] .notion-divider {
    background: rgba(255, 255, 255, 0.07);
}


/* === 7. Button === */

.hk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 32px;
    font-size: 13px;
    padding: 6px 16px;
    border: none;
    border-radius: var(--hk-radius-md);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.1s ease;
    outline: none;
    box-shadow: none;
    white-space: nowrap;
}

.hk-btn:focus {
    outline: none !important;
    box-shadow: none !important;
}

.hk-btn:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* Size variants */
.hk-btn--sm {
    height: 28px;
    font-size: 12px;
    padding: 6px 12px;
}

.hk-btn--sm .material-symbols-rounded {
    font-size: 16px;
}

.hk-btn--md {
    height: 32px;
    font-size: 13px;
    padding: 6px 16px;
}

.hk-btn--md .material-symbols-rounded {
    font-size: 18px;
}

.hk-btn--lg {
    height: 36px;
    font-size: 14px;
    padding: 8px 20px;
}

.hk-btn--lg .material-symbols-rounded {
    font-size: 20px;
}

/* Primary variant */
.hk-btn--primary {
    background: var(--hk-btn-primary);
    color: white;
}

.hk-btn--primary:hover:not(:disabled) {
    background: var(--hk-btn-primary-hover);
}

.hk-btn--primary:active:not(:disabled) {
    background: var(--hk-btn-primary-active);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

/* Secondary variant */
.hk-btn--secondary {
    background: var(--hk-bg-hover);
    color: var(--hk-text-primary);
}

.hk-btn--secondary:hover:not(:disabled) {
    background: var(--hk-bg-active);
}

.hk-btn--secondary:active:not(:disabled) {
    background: rgba(55, 53, 47, 0.24);
}

[data-theme="dark"] .hk-btn--secondary:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.24);
}

/* Outline variant */
.hk-btn--outline {
    background: transparent;
    color: var(--hk-text-primary);
    border: 1px solid var(--hk-border-default);
}

.hk-btn--outline:hover:not(:disabled) {
    background: var(--hk-bg-hover);
}

.hk-btn--outline:active:not(:disabled) {
    background: var(--hk-bg-active);
}

/* Ghost variant */
.hk-btn--ghost {
    background: transparent;
    color: var(--hk-text-primary);
}

.hk-btn--ghost:hover:not(:disabled) {
    background: var(--hk-bg-hover);
}

.hk-btn--ghost:active:not(:disabled) {
    background: var(--hk-bg-active);
}

/* Danger variant */
.hk-btn--danger {
    background: var(--hk-btn-danger);
    color: white;
}

.hk-btn--danger:hover:not(:disabled) {
    background: var(--hk-btn-danger-hover);
}

.hk-btn--danger:active:not(:disabled) {
    background: var(--hk-btn-danger-active);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

/* Success variant */
.hk-btn--success {
    background: var(--hk-color-success);
    color: #fff;
    border-color: var(--hk-color-success);
}

.hk-btn--success:hover:not(:disabled) {
    background: #047857;
    border-color: #047857;
}

.hk-btn--success:active:not(:disabled) {
    background: #065f46;
    border-color: #065f46;
}

/* Warning variant */
.hk-btn--warning {
    background: var(--hk-color-warning);
    color: #fff;
    border-color: var(--hk-color-warning);
}

.hk-btn--warning:hover:not(:disabled) {
    background: #b45309;
    border-color: #b45309;
}

.hk-btn--warning:active:not(:disabled) {
    background: #92400e;
    border-color: #92400e;
}

/* Link variant */
.hk-btn--link {
    background: transparent;
    color: var(--hk-color-primary);
    text-decoration: none;
    padding: 4px 0;
}

.hk-btn--link:hover:not(:disabled) {
    text-decoration: underline;
}

/* Icon button */
.hk-btn--icon {
    width: 32px;
    height: 32px;
    padding: 0;
}

.hk-btn--sm.hk-btn--icon {
    width: 28px;
    height: 28px;
}

.hk-btn--lg.hk-btn--icon {
    width: 36px;
    height: 36px;
}

/* Disabled state */
.hk-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading state */
.hk-btn--loading {
    position: relative;
}

.hk-btn--loading.hk-btn--primary {
    background: var(--hk-btn-primary-hover);
}

.hk-btn__spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: hk-spin 0.8s linear infinite;
}

@keyframes hk-spin {
    to { transform: rotate(360deg); }
}

/* Button group */
.hk-btn-group {
    display: inline-flex;
    gap: 0;
}

.hk-btn-group .hk-btn {
    border-radius: 0;
}

.hk-btn-group .hk-btn:first-child {
    border-radius: var(--hk-radius-md) 0 0 var(--hk-radius-md);
}

.hk-btn-group .hk-btn:last-child {
    border-radius: 0 var(--hk-radius-md) var(--hk-radius-md) 0;
}

.hk-btn-group .hk-btn:not(:last-child) {
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}


/* === 8. Badge === */

/* Badge base */
.hk-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: var(--hk-badge-status-padding);
    border-radius: var(--hk-radius-sm);
    font-size: 12px;
    font-weight: 500;
    transition: background 0.1s ease, color 0.1s ease;
}

.hk-badge--sm {
    height: var(--hk-badge-sm-height);
}

.hk-badge--md {
    height: var(--hk-badge-md-height);
}

.hk-badge__dot {
    display: inline-block;
    width: var(--hk-badge-status-dot-size);
    height: var(--hk-badge-status-dot-size);
    border-radius: 50%;
    flex-shrink: 0;
}

.hk-badge__text {
    font-size: 12px;
    font-weight: 500;
}

/* Status variants */
.hk-badge--status.hk-badge--success {
    background: var(--hk-badge-success-bg);
    color: var(--hk-badge-success-text);
}

.hk-badge--status.hk-badge--success .hk-badge__dot {
    background: var(--hk-badge-success-dot);
}

.hk-badge--status.hk-badge--warning {
    background: var(--hk-badge-warning-bg);
    color: var(--hk-badge-warning-text);
}

.hk-badge--status.hk-badge--warning .hk-badge__dot {
    background: var(--hk-badge-warning-dot);
}

.hk-badge--status.hk-badge--danger {
    background: var(--hk-badge-danger-bg);
    color: var(--hk-badge-danger-text);
}

.hk-badge--status.hk-badge--danger .hk-badge__dot {
    background: var(--hk-badge-danger-dot);
}

.hk-badge--status.hk-badge--info {
    background: var(--hk-badge-info-bg);
    color: var(--hk-badge-info-text);
}

.hk-badge--status.hk-badge--info .hk-badge__dot {
    background: var(--hk-badge-info-dot);
}

.hk-badge--status.hk-badge--neutral {
    background: var(--hk-badge-neutral-bg);
    color: var(--hk-badge-neutral-text);
}

.hk-badge--status.hk-badge--neutral .hk-badge__dot {
    background: var(--hk-badge-neutral-dot);
}

.hk-badge--status.hk-badge--primary {
    background: var(--hk-badge-primary-bg);
    color: var(--hk-badge-primary-text);
}

.hk-badge--status.hk-badge--primary .hk-badge__dot {
    background: var(--hk-badge-primary-dot);
}

/* Standalone badge colors (cho truong hop dung khong co --status) */
.hk-badge--success {
    background: var(--hk-badge-success-bg);
    color: var(--hk-badge-success-text);
}

.hk-badge--warning {
    background: var(--hk-badge-warning-bg);
    color: var(--hk-badge-warning-text);
}

.hk-badge--danger {
    background: var(--hk-badge-danger-bg);
    color: var(--hk-badge-danger-text);
}

.hk-badge--info {
    background: var(--hk-badge-info-bg);
    color: var(--hk-badge-info-text);
}

.hk-badge--neutral {
    background: var(--hk-badge-neutral-bg);
    color: var(--hk-badge-neutral-text);
}

.hk-badge--primary {
    background: var(--hk-badge-primary-bg);
    color: var(--hk-badge-primary-text);
}

/* Count badge */
.hk-badge--count {
    padding: 0;
    min-width: var(--hk-badge-count-size);
    width: var(--hk-badge-count-size);
    height: var(--hk-badge-count-size);
    border-radius: 9999px;
    font-size: var(--hk-badge-count-font-size);
    font-weight: var(--hk-badge-count-font-weight);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hk-badge-danger-bg);
    color: var(--hk-badge-danger-text);
}

/* Pill variant */
.hk-badge--pill {
    border-radius: var(--hk-badge-pill-border-radius);
    padding: var(--hk-badge-pill-padding);
}

.hk-badge--pill.hk-tag {
    padding: var(--hk-badge-pill-padding);
    border-radius: var(--hk-badge-pill-border-radius);
}

/* Tag */
.hk-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: var(--hk-tag-padding);
    height: var(--hk-tag-height);
    border-radius: var(--hk-tag-border-radius);
    font-size: var(--hk-tag-font-size);
    font-weight: var(--hk-tag-font-weight);
}

.hk-tag__text {
    flex-grow: 1;
}

.hk-tag__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: var(--hk-text-secondary);
    transition: color 0.1s ease;
    width: 20px;
    height: 20px;
}

.hk-tag__remove:hover {
    color: var(--hk-text-primary);
}

.hk-tag__remove .material-symbols-rounded {
    font-size: var(--hk-badge-remove-icon-size);
}

/* Tag color variants */
.hk-tag--blush {
    background: var(--hk-tag-blush-bg);
    color: var(--hk-tag-blush-text);
}

.hk-tag--coral {
    background: var(--hk-tag-coral-bg);
    color: var(--hk-tag-coral-text);
}

.hk-tag--lightblue {
    background: var(--hk-tag-lightblue-bg);
    color: var(--hk-tag-lightblue-text);
}

.hk-tag--rose {
    background: var(--hk-tag-rose-bg);
    color: var(--hk-tag-rose-text);
}

.hk-tag--beige {
    background: var(--hk-tag-beige-bg);
    color: var(--hk-tag-beige-text);
}

.hk-tag--gray {
    background: var(--hk-tag-gray-bg);
    color: var(--hk-tag-gray-text);
}


/* === 9. Card === */

.hk-card {
    background: var(--hk-bg-surface);
    border: 1px solid var(--hk-border-light);
    border-radius: var(--hk-radius-lg);
    box-shadow: var(--hk-shadow-card);
    overflow: hidden;
}

.hk-card__header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--hk-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hk-card__header-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--hk-text-primary);
}

.hk-card__header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--hk-radius-sm);
    background: transparent;
    color: var(--hk-text-muted);
    cursor: pointer;
    padding: 0;
}

.hk-card__header-action:hover {
    background: var(--hk-bg-hover);
}

.hk-card__body {
    padding: 16px;
}

.hk-card__body > * + * {
    margin-top: 12px;
}

.hk-card__footer {
    padding: 12px 16px;
    border-top: 1px solid var(--hk-border-light);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* Card variants */
.hk-card--flat {
    box-shadow: none;
}

.hk-card--outlined {
    box-shadow: none;
    border-color: var(--hk-border-default);
}

.hk-card--interactive {
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.hk-card--interactive:hover {
    box-shadow: var(--hk-shadow-md);
    transform: translateY(-2px);
}

.hk-card--no-padding .hk-card__body {
    padding: 0;
}

/* Stat Card */
.hk-card-stat {
    background: var(--hk-bg-surface);
    border: 1px solid var(--hk-border-light);
    border-radius: var(--hk-radius-lg);
    box-shadow: var(--hk-shadow-card);
    padding: 16px;
    text-align: center;
}

.hk-card-stat__value {
    font-size: 24px;
    font-weight: 700;
    color: var(--hk-text-primary);
    margin-bottom: 4px;
}

.hk-card-stat__label {
    font-size: 12px;
    font-weight: 400;
    color: var(--hk-text-muted);
    margin-bottom: 8px;
}

.hk-card-stat__trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 400;
}

.hk-card-stat__trend--up {
    color: var(--hk-color-success);
}

.hk-card-stat__trend--down {
    color: var(--hk-color-danger);
}

/* Kanban Card */
.hk-card-kanban {
    background: var(--hk-bg-surface);
    border: 1px solid var(--hk-border-light);
    border-radius: var(--hk-radius-lg);
    box-shadow: var(--hk-shadow-card);
    padding: 8px 10px;
}

.hk-card-kanban__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.hk-card-kanban__title {
    font-size: 14px;
    font-weight: 400;
    color: var(--hk-text-primary);
    flex: 1;
    word-break: break-word;
}

.hk-card-kanban__status {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--hk-text-muted);
    flex-shrink: 0;
    margin-right: 6px;
}

.hk-card-kanban__status--active {
    background: var(--hk-color-success);
}

.hk-card-kanban__metadata {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.hk-card-kanban__avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--hk-color-success);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.hk-card-kanban__badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: var(--hk-radius-sm);
    background: var(--hk-bg-hover);
    color: var(--hk-text-primary);
    font-size: 11px;
    font-weight: 400;
}

/* Card Group */
.hk-card-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}


/* === 10. Pagination === */

/* Wrapper -- dung voi Bootstrap pagination hoac custom */
.hk-pagination {
    padding: 8px 16px;
}

/* Bootstrap pagination override cho Notion-style */
.pagination {
    gap: 2px;
    margin: 0;
}

.pagination .page-link {
    font-size: 13px;
    border: none;
    color: var(--hk-text-secondary);
    border-radius: var(--hk-radius-sm);
    padding: 4px 8px;
    min-width: 28px;
    height: 28px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    background-color: transparent;
}

.pagination .page-link .material-symbols-rounded {
    font-size: 16px;
    line-height: 1;
}

.pagination .page-link:hover {
    background-color: var(--hk-bg-hover);
    color: var(--hk-text-primary);
}

.pagination .page-link:focus {
    box-shadow: none;
    background-color: var(--hk-bg-hover);
}

.pagination .page-item.active .page-link {
    background-color: var(--hk-color-primary);
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    color: var(--hk-text-hint);
    background-color: transparent;
}

/* Custom pagination (tu table/example.html) */
.hk-pagination__info {
    font-size: 13px;
    color: var(--hk-text-muted);
    white-space: nowrap;
}

.hk-pagination__controls {
    display: flex;
    align-items: center;
    gap: 2px;
}

.hk-pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border: none;
    border-radius: var(--hk-radius-sm);
    background: transparent;
    color: var(--hk-text-secondary);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s ease;
    font-family: inherit;
}

.hk-pagination__btn:hover {
    background: var(--hk-bg-hover);
}

.hk-pagination__btn--active {
    background: var(--hk-bg-hover);
    color: var(--hk-text-primary);
    font-weight: 500;
}

.hk-pagination__btn--active:hover {
    background: var(--hk-bg-active);
}

.hk-pagination__btn--disabled {
    color: var(--hk-text-muted);
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.hk-pagination__btn .material-symbols-rounded {
    font-size: 18px;
}

.hk-pagination__ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    color: var(--hk-text-muted);
    font-size: 13px;
    user-select: none;
}

.hk-pagination__per-page {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--hk-text-muted);
    white-space: nowrap;
}

.hk-pagination__per-page select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    border-radius: var(--hk-radius-sm);
    padding: 2px 20px 2px 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--hk-text-primary);
    cursor: pointer;
    height: 28px;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2337352f' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

.hk-pagination__per-page select:hover {
    background-color: var(--hk-bg-hover);
}

.hk-pagination__per-page select:focus {
    background-color: var(--hk-bg-hover);
}

[data-theme="dark"] .hk-pagination__per-page select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23ffffffcf' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}


/* === 11. Form Layout === */

.hk-form {
    display: flex;
    flex-direction: column;
    gap: var(--hk-form-section-gap);
}

.hk-form--horizontal {
    gap: var(--hk-form-group-gap);
}

.hk-form--horizontal .hk-form-group {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.hk-form--horizontal .hk-form-group__label {
    flex: 0 0 30%;
    padding-top: 6px;
}

.hk-form--horizontal .hk-form-group__content {
    flex: 0 0 70%;
}

.hk-form--horizontal .hk-form-group__helper,
.hk-form--horizontal .hk-form-group__error,
.hk-form--horizontal .hk-form-group__success {
    margin-left: 30%;
}

.hk-form-section {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hk-form-section__header {
    margin-bottom: 12px;
}

.hk-form-section__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--hk-text-primary);
    margin-bottom: 4px;
}

.hk-form-section__desc {
    font-size: 12px;
    color: var(--hk-form-label-color);
    margin: 0;
}

.hk-form-section__divider {
    height: 1px;
    background: var(--hk-form-divider);
    margin: 12px 0 16px 0;
}

.hk-form-section > .hk-form-group:not(:last-child) {
    margin-bottom: var(--hk-form-group-gap);
}

.hk-form-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hk-form-group__label {
    font-size: var(--hk-form-label-font-size);
    font-weight: var(--hk-form-label-font-weight);
    color: var(--hk-form-label-color);
    margin-bottom: 6px;
    line-height: 1.4;
}

.hk-form-group__content {
    display: flex;
    flex-direction: column;
}

.hk-form-group__helper {
    font-size: var(--hk-form-helper-font-size);
    color: var(--hk-form-helper-color);
    margin-top: 4px;
    line-height: 1.4;
}

.hk-form-group__error {
    font-size: var(--hk-form-helper-font-size);
    color: var(--hk-form-error-color);
    margin-top: 4px;
    line-height: 1.4;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.hk-form-group__success {
    font-size: var(--hk-form-helper-font-size);
    color: var(--hk-form-success-color);
    margin-top: 4px;
    line-height: 1.4;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.hk-form-group__error .material-symbols-rounded,
.hk-form-group__success .material-symbols-rounded {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.required {
    color: var(--hk-form-required-color);
}


/* === 12. Alert === */

.hk-alert {
    display: flex;
    align-items: center;
    gap: var(--hk-alert-gap);
    padding: var(--hk-alert-padding);
    border-radius: var(--hk-alert-border-radius);
    transition: all 0.15s ease;
}

/* Alert types */
.hk-alert--info {
    background-color: var(--hk-alert-info-bg);
    color: var(--hk-alert-info-text);
}

.hk-alert--info:hover {
    background-color: rgba(2, 132, 199, 0.12);
}

.hk-alert--success {
    background-color: var(--hk-alert-success-bg);
    color: var(--hk-alert-success-text);
}

.hk-alert--success:hover {
    background-color: rgba(5, 150, 105, 0.12);
}

.hk-alert--warning {
    background-color: var(--hk-alert-warning-bg);
    color: var(--hk-alert-warning-text);
}

.hk-alert--warning:hover {
    background-color: rgba(217, 119, 6, 0.12);
}

.hk-alert--danger {
    background-color: var(--hk-alert-danger-bg);
    color: var(--hk-alert-danger-text);
}

.hk-alert--danger:hover {
    background-color: rgba(220, 38, 38, 0.12);
}

/* Inline variant */
.hk-alert--inline {
    padding: var(--hk-alert-padding-inline);
    gap: 8px;
}

/* Banner variant */
.hk-alert--banner {
    border-left: none;
    border-radius: 0;
    align-items: center;
}

.hk-alert__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--hk-alert-icon-size);
    flex-shrink: 0;
}

.hk-alert__content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.hk-alert__title {
    font-size: 13px;
    font-weight: 600;
    color: inherit;
}

.hk-alert__description {
    font-size: 13px;
    font-weight: 400;
    color: inherit;
    line-height: 1.4;
}

.hk-alert__close,
.hk-alert__action {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-radius: var(--hk-radius-md);
    color: inherit;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.1s ease;
    flex-shrink: 0;
}

.hk-alert__close:hover,
.hk-alert__action:hover {
    background: currentColor;
    opacity: 0.1;
}

.hk-alert__close:focus,
.hk-alert__action:focus {
    outline: none;
    box-shadow: none !important;
    background: currentColor;
    opacity: 0.15;
}

.hk-alert__close {
    padding: 4px;
}

.hk-alert__close .material-symbols-rounded {
    font-size: 20px;
}

.hk-alert.hidden {
    display: none;
}


/* === 13. Dark Mode Overrides === */
/* Bootstrap/third-party dark mode fixes */

[data-theme="dark"] .dropdown-menu {
    background-color: var(--hk-bg-surface-raised);
    border-color: var(--hk-border-default);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .dropdown-item {
    color: var(--hk-text-primary);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--hk-bg-hover);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .dropdown-divider {
    border-color: var(--hk-border-light);
}

[data-theme="dark"] .modal-content {
    background-color: var(--hk-bg-surface);
    border-color: var(--hk-border-default);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .modal-header {
    border-bottom-color: var(--hk-border-light);
}

[data-theme="dark"] .modal-footer {
    border-top-color: var(--hk-border-light);
}

[data-theme="dark"] .modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .form-control {
    background-color: var(--hk-bg-surface);
    border-color: var(--hk-border-default);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--hk-text-hint);
}

[data-theme="dark"] .form-control:focus {
    background-color: var(--hk-bg-surface);
    border-color: var(--hk-border-strong);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .form-select {
    background-color: var(--hk-bg-surface);
    border-color: var(--hk-border-default);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .form-select:focus {
    background-color: var(--hk-bg-surface);
    border-color: var(--hk-border-strong);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .form-check-input {
    background-color: var(--hk-bg-surface);
    border-color: var(--hk-border-default);
}

[data-theme="dark"] .form-check-input:checked {
    background-color: var(--hk-color-primary);
    border-color: var(--hk-color-primary);
}

[data-theme="dark"] .table {
    color: var(--hk-text-primary);
}

[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: transparent;
    color: var(--hk-text-primary);
}

[data-theme="dark"] .card {
    background-color: var(--hk-bg-surface);
    border-color: var(--hk-border-light);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .list-group-item {
    background-color: var(--hk-bg-surface);
    border-color: var(--hk-border-light);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .offcanvas {
    background-color: var(--hk-bg-surface);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .toast {
    background-color: var(--hk-bg-surface-raised);
    border-color: var(--hk-border-light);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .popover {
    background-color: var(--hk-bg-surface-raised);
    border-color: var(--hk-border-light);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .tooltip .tooltip-inner {
    background-color: var(--hk-bg-surface-raised);
    color: var(--hk-text-primary);
}

[data-theme="dark"] .breadcrumb {
    color: var(--hk-text-muted);
}

[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: var(--hk-text-hint);
}

[data-theme="dark"] .breadcrumb-item.active {
    color: var(--hk-text-muted);
}

[data-theme="dark"] .breadcrumb-item a {
    color: var(--hk-color-primary);
}

[data-theme="dark"] .alert-info:hover {
    background-color: rgba(2, 132, 199, 0.25);
}

[data-theme="dark"] .alert-success:hover {
    background-color: rgba(5, 150, 105, 0.25);
}

[data-theme="dark"] .alert-warning:hover {
    background-color: rgba(217, 119, 6, 0.25);
}

[data-theme="dark"] .alert-danger:hover {
    background-color: rgba(220, 38, 38, 0.25);
}


/* === 14. Utilities === */

/* Notion-style table badge colors (Notion pastel) */
.hk-badge--1 { background: rgba(227, 226, 224, 0.5); color: rgba(55, 53, 47, 0.65); }
.hk-badge--2 { background: rgba(245, 224, 233, 0.5); color: rgb(193, 76, 138); }
.hk-badge--3 { background: rgba(253, 236, 200, 0.5); color: rgb(217, 115, 13); }
.hk-badge--4 { background: rgba(219, 237, 219, 0.5); color: rgb(15, 123, 108); }
.hk-badge--5 { background: rgba(211, 229, 239, 0.5); color: rgb(24, 51, 71); }

[data-theme="dark"] .hk-badge--1 { background: rgba(90, 90, 90, 0.3); color: rgba(255,255,255,0.55); }
[data-theme="dark"] .hk-badge--2 { background: rgba(120, 50, 80, 0.3); color: rgb(230, 130, 180); }
[data-theme="dark"] .hk-badge--3 { background: rgba(120, 80, 30, 0.3); color: rgb(255, 180, 80); }
[data-theme="dark"] .hk-badge--4 { background: rgba(40, 90, 70, 0.3); color: rgb(80, 200, 170); }
[data-theme="dark"] .hk-badge--5 { background: rgba(40, 70, 100, 0.3); color: rgb(130, 190, 230); }

/* Progress bar utility */
.hk-progress {
    height: 4px;
    background: var(--hk-bg-hover);
    border-radius: var(--hk-radius-full);
    overflow: hidden;
}

.hk-progress__bar {
    height: 100%;
    border-radius: var(--hk-radius-full);
    transition: width 0.3s ease;
}

.hk-progress__bar--primary { background: var(--hk-color-primary); }
.hk-progress__bar--success { background: var(--hk-color-success); }
.hk-progress__bar--danger { background: var(--hk-color-danger); }
.hk-progress__bar--warning { background: var(--hk-color-warning); }
.hk-progress__bar--info { background: var(--hk-color-info); }

/* Material Symbols Rounded base */
.material-symbols-rounded {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 18px;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'opsz' 20;
    user-select: none;
}

/* === 15. App Layout === */
.hk-main {
    margin-left: 260px;
    min-height: 100vh;
    background: var(--hk-bg-page);
    transition: background 0.2s;
}
.top-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: 56px;
    background: var(--hk-bg-surface);
    border-bottom: 1px solid var(--hk-border-light);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.top-header__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--hk-text-primary);
}
.hk-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--hk-radius-md);
    background: transparent;
    color: var(--hk-icon-default);
    cursor: pointer;
    transition: background 0.15s;
}
.hk-theme-toggle:hover {
    background: var(--hk-bg-hover);
    color: var(--hk-text-primary);
}
.hk-content {
    padding: 20px;
}
/* Mobile sidebar */
@media (max-width: 768px) {
    .hk-sidebar { transform: translateX(-100%); }
    .hk-sidebar.hk-sidebar--mobile-show { transform: translateX(0); }
    .hk-main { margin-left: 0; }
}

/* === Realtime / Live Indicators === */

/* Badge nhap nhay cho trang thai dang chay */
@keyframes hk-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.hk-badge--live {
    animation: hk-pulse 1.5s ease-in-out infinite;
}

/* Dot xanh nhap nhay ben canh text */
@keyframes hk-dot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}
.hk-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--hk-color-success);
    margin-right: 6px;
    vertical-align: middle;
    animation: hk-dot-pulse 1.5s ease-in-out infinite;
}
.hk-live-dot--danger {
    background: var(--hk-color-danger);
}

/* Counter so nhay mượt */
.hk-live-counter {
    transition: all 0.3s ease;
    display: inline-block;
}
.hk-live-counter--bump {
    transform: scale(1.15);
    color: var(--hk-color-primary);
}

/* Progress bar mượt */
.hk-progress__bar--animated {
    transition: width 0.5s ease-in-out;
}

/* Log entry moi fade in */
@keyframes hk-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.hk-log-entry--new {
    animation: hk-fade-in 0.3s ease-out;
}

/* Skeleton loading */
@keyframes hk-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.hk-skeleton {
    background: linear-gradient(90deg, var(--hk-bg-hover) 25%, var(--hk-bg-surface) 50%, var(--hk-bg-hover) 75%);
    background-size: 200% 100%;
    animation: hk-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--hk-radius-sm);
}

/* Trang thai ket noi WebSocket */
.hk-ws-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--hk-text-muted);
    padding: 2px 8px;
    border-radius: var(--hk-radius-sm);
}
.hk-ws-status--connected { color: var(--hk-color-success); }
.hk-ws-status--disconnected { color: var(--hk-color-danger); }
.hk-ws-status__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
