:root {
    --brand-primary: #d82020;
    --brand-primary-dark: #b51b1b;
    --brand-secondary: #fde8e8;
}

html,
body {
    margin: 0;
    background: #f8fafc;
    color: #1e293b;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--brand-primary) var(--brand-secondary);
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: var(--brand-secondary);
}

*::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border-radius: 9999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--brand-primary-dark);
}

input[type="checkbox"] {
    accent-color: var(--brand-primary);
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#sidebar {
    background: #0f172a;
}

#sidebar .sidebar-link.is-active {
    background: var(--brand-primary);
    color: #fff;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    box-sizing: border-box;
    height: 2.375rem;
    border-radius: 0.5rem;
    background: var(--brand-primary);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    color: #fff;
    transition: background-color 0.15s ease;
}

.btn-primary:hover {
    background: var(--brand-primary-dark);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    box-sizing: border-box;
    height: 2.375rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    color: #334155;
    transition: background-color 0.15s ease;
}

.btn-secondary:hover {
    background: #f8fafc;
}

.pager-btn {
    box-sizing: border-box;
    width: 2.375rem;
    min-width: 2.375rem;
    height: 2.375rem;
    padding: 0;
}

.btn-primary.pager-btn {
    border: 1px solid var(--brand-primary);
}

.btn-export-excel,
.btn-export-pdf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    transition: background-color 0.15s ease;
}

.btn-export-excel {
    background: #16a34a;
    color: #fff;
}

.btn-export-excel:hover {
    background: #15803d;
}

.btn-export-pdf {
    background: #dc2626;
    color: #fff;
}

.btn-export-pdf:hover {
    background: #b91c1c;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    border-radius: 0.5rem;
    background: #dc2626;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    transition: background-color 0.15s ease;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: #1e293b;
}

@media (max-width: 639px) {
    .app-header {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        gap: 0.5rem;
    }

    .app-header>.flex {
        gap: 0.25rem;
    }

    .app-header .btn-ghost,
    .app-header .btn-secondary {
        box-sizing: border-box;
        height: 2.25rem;
        width: 2.25rem;
        min-width: 2.25rem;
        padding: 0;
    }

    .app-header .btn-secondary .ti-chevron-down {
        display: none;
    }

    .app-header img.h-8 {
        height: 2rem;
        width: 2rem;
        flex-shrink: 0;
    }
}

.modal-box [data-close]:has(.ti-x),
.modal-box-sm [data-close]:has(.ti-x),
.modal-box-md [data-close]:has(.ti-x),
.modal-box-lg [data-close]:has(.ti-x) {
    height: 2rem;
    width: 2rem;
    flex-shrink: 0;
    border-radius: 9999px;
    background: #f1f5f9;
    padding: 0;
    font-size: 1rem;
    color: #64748b;
    box-shadow: none;
}

.modal-box [data-close]:has(.ti-x):hover,
.modal-box-sm [data-close]:has(.ti-x):hover,
.modal-box-md [data-close]:has(.ti-x):hover,
.modal-box-lg [data-close]:has(.ti-x):hover {
    background: var(--brand-primary);
    color: #fff;
}

.td-cell .btn-ghost:has(.ti-check),
.td-cell .btn-ghost:has(.ti-switch),
.td-cell .btn-ghost:has(.ti-transform),
.td-cell .btn-ghost:has(.ti-restore),
.td-cell a.btn-ghost:has(.ti-check),
.td-cell a.btn-ghost:has(.ti-switch),
.td-cell a.btn-ghost:has(.ti-transform),
.td-cell a.btn-ghost:has(.ti-restore) {
    margin-right: 0.375rem;
    height: 2rem;
    width: 2rem;
    border-radius: 0.5rem;
    background: #ecfdf5;
    padding: 0;
    font-size: 1rem;
    color: #059669;
    box-shadow: none;
}

.td-cell .btn-ghost:has(.ti-check):hover,
.td-cell .btn-ghost:has(.ti-switch):hover,
.td-cell .btn-ghost:has(.ti-transform):hover,
.td-cell .btn-ghost:has(.ti-restore):hover,
.td-cell a.btn-ghost:has(.ti-check):hover,
.td-cell a.btn-ghost:has(.ti-switch):hover,
.td-cell a.btn-ghost:has(.ti-transform):hover,
.td-cell a.btn-ghost:has(.ti-restore):hover {
    background: #059669;
    color: #fff;
}

.td-cell .btn-ghost:has(.ti-eye),
.td-cell a.btn-ghost:has(.ti-eye) {
    margin-right: 0.375rem;
    height: 2rem;
    width: 2rem;
    border-radius: 0.5rem;
    background: #f5f3ff;
    padding: 0;
    font-size: 1rem;
    color: #7c3aed;
    box-shadow: none;
}

.td-cell .btn-ghost:has(.ti-eye):hover,
.td-cell a.btn-ghost:has(.ti-eye):hover {
    background: #7c3aed;
    color: #fff;
}

.td-cell .btn-ghost:has(.ti-printer),
.td-cell a.btn-ghost:has(.ti-printer) {
    margin-right: 0.375rem;
    height: 2rem;
    width: 2rem;
    border-radius: 0.5rem;
    background: #eef2ff;
    padding: 0;
    font-size: 1rem;
    color: #4f46e5;
    box-shadow: none;
}

.td-cell .btn-ghost:has(.ti-printer):hover,
.td-cell a.btn-ghost:has(.ti-printer):hover {
    background: #4f46e5;
    color: #fff;
}

.td-cell .btn-ghost:has(.ti-history),
.td-cell a.btn-ghost:has(.ti-history) {
    margin-right: 0.375rem;
    height: 2rem;
    width: 2rem;
    border-radius: 0.5rem;
    background: #f0fdfa;
    padding: 0;
    font-size: 1rem;
    color: #0d9488;
    box-shadow: none;
}

.td-cell .btn-ghost:has(.ti-history):hover,
.td-cell a.btn-ghost:has(.ti-history):hover {
    background: #0d9488;
    color: #fff;
}

.td-cell .btn-ghost:has(.ti-arrow-back-up),
.td-cell a.btn-ghost:has(.ti-arrow-back-up) {
    margin-right: 0.375rem;
    height: 2rem;
    width: 2rem;
    border-radius: 0.5rem;
    background: #fff7ed;
    padding: 0;
    font-size: 1rem;
    color: #ea580c;
    box-shadow: none;
}

.td-cell .btn-ghost:has(.ti-arrow-back-up):hover,
.td-cell a.btn-ghost:has(.ti-arrow-back-up):hover {
    background: #ea580c;
    color: #fff;
}

.td-cell .btn-ghost:has(.ti-book),
.td-cell .btn-ghost:has(.ti-book-2),
.td-cell a.btn-ghost:has(.ti-book),
.td-cell a.btn-ghost:has(.ti-book-2) {
    margin-right: 0.375rem;
    height: 2rem;
    width: 2rem;
    border-radius: 0.5rem;
    background: #fffbeb;
    padding: 0;
    font-size: 1rem;
    color: #d97706;
    box-shadow: none;
}

.td-cell .btn-ghost:has(.ti-book):hover,
.td-cell .btn-ghost:has(.ti-book-2):hover,
.td-cell a.btn-ghost:has(.ti-book):hover,
.td-cell a.btn-ghost:has(.ti-book-2):hover {
    background: #d97706;
    color: #fff;
}

.td-cell .btn-ghost:has(.ti-edit),
.td-cell .btn-ghost:has(.ti-pencil),
.td-cell a.btn-ghost:has(.ti-edit),
.td-cell a.btn-ghost:has(.ti-pencil) {
    margin-right: 0.375rem;
    height: 2rem;
    width: 2rem;
    border-radius: 0.5rem;
    background: #f0f9ff;
    padding: 0;
    font-size: 1rem;
    color: #0284c7;
    box-shadow: none;
}

.td-cell .btn-ghost:has(.ti-edit):hover,
.td-cell .btn-ghost:has(.ti-pencil):hover,
.td-cell a.btn-ghost:has(.ti-edit):hover,
.td-cell a.btn-ghost:has(.ti-pencil):hover {
    background: #0284c7;
    color: #fff;
}

.td-cell .btn-ghost:has(.ti-trash),
.td-cell .btn-ghost:has(.ti-trash-x),
.td-cell .btn-ghost:has(.ti-x),
.td-cell .btn-ghost:has(.ti-ban),
.td-cell a.btn-ghost:has(.ti-trash),
.td-cell a.btn-ghost:has(.ti-trash-x),
.td-cell a.btn-ghost:has(.ti-ban) {
    height: 2rem;
    width: 2rem;
    border-radius: 0.5rem;
    background: #fef2f2;
    padding: 0;
    font-size: 1rem;
    color: #dc2626;
    box-shadow: none;
}

.td-cell .btn-ghost:has(.ti-trash):hover,
.td-cell .btn-ghost:has(.ti-trash-x):hover,
.td-cell .btn-ghost:has(.ti-x):hover,
.td-cell .btn-ghost:has(.ti-ban):hover,
.td-cell a.btn-ghost:has(.ti-trash):hover,
.td-cell a.btn-ghost:has(.ti-trash-x):hover,
.td-cell a.btn-ghost:has(.ti-ban):hover {
    background: #dc2626;
    color: #fff;
}

.field {
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #1e293b;
    outline: none;
    box-shadow: none;
}

input.field,
select.field {
    height: 2.375rem;
}

.field:focus,
.field:focus-visible {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-primary) 20%, transparent);
}

.label-text {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
}

.label-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border: 1px solid #94a3b8;
    border-radius: 999px;
    color: #64748b;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    user-select: none;
    flex-shrink: 0;
}

.label-help:hover,
.label-help:focus {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    outline: none;
}

.page-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.25rem;
    color: #64748b;
}

.page-breadcrumb>* {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.page-breadcrumb>*+*::before {
    content: "";
    width: 0.35rem;
    height: 0.35rem;
    margin-right: 0.5rem;
    margin-left: 0.25rem;
    border-right: 1.5px solid #94a3b8;
    border-top: 1.5px solid #94a3b8;
    transform: rotate(45deg);
    flex-shrink: 0;
}

.page-breadcrumb a {
    color: #64748b;
}

.page-breadcrumb a:hover {
    color: var(--brand-primary);
}

.page-breadcrumb i {
    font-size: 0.95rem;
}

.page-breadcrumb .is-current {
    font-weight: 600;
    color: #0f172a;
}

.card {
    min-width: 0;
    max-width: 100%;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.card .flex {
    min-width: 0;
    max-width: 100%;
}

.card>.flex>h3 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card>.flex>.btn-secondary {
    flex-shrink: 0;
    height: 1.75rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    line-height: 1rem;
    white-space: nowrap;
}

.badge-ok {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background: #ecfdf5;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #047857;
}

.badge-no {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background: #fef2f2;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #b91c1c;
}

.badge-warn {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background: #fffbeb;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #b45309;
}

.badge-mute {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background: #f1f5f9;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #475569;
}

.badge-info {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background: #eff6ff;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #1d4ed8;
}

.modal-root {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    overflow: hidden;
}

.modal-box,
.modal-box-sm,
.modal-box-md,
.modal-box-lg {
    position: relative;
    z-index: 10;
    display: flex;
    width: 100%;
    max-height: calc(100vh - 3rem);
    max-height: calc(100dvh - 3rem);
    flex-direction: column;
    overflow: hidden;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 20px 25px rgba(15, 23, 42, 0.15);
}

.modal-box>form,
.modal-box-sm>form,
.modal-box-md>form,
.modal-box-lg>form {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
}

.modal-root form>.flex {
    flex-shrink: 0;
}

.modal-root form>.modal-fields,
.modal-root form>.p-5 {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.modal-root form>.modal-fields::-webkit-scrollbar,
.modal-root form>.p-5::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.modal-root form>.modal-fields::-webkit-scrollbar-track,
.modal-root form>.p-5::-webkit-scrollbar-track {
    background: transparent;
}

.modal-root form>.modal-fields::-webkit-scrollbar-thumb,
.modal-root form>.p-5::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.modal-box-sm {
    max-width: 28rem;
}

.modal-box-md {
    max-width: 48rem;
}

.modal-box-lg {
    max-width: 64rem;
}

.modal-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 768px) {

    .modal-box-md .modal-fields:has(> :nth-child(3)),
    .modal-box-lg .modal-fields:has(> :nth-child(3)) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .modal-box-md .modal-fields:has(> :nth-child(7)),
    .modal-box-lg .modal-fields:has(> :nth-child(7)) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.modal-fields>label.flex,
.modal-fields>.file-drop,
.modal-fields>div:has(textarea) {
    grid-column: 1 / -1;
}

.th-cell {
    white-space: nowrap;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    color: #64748b;
}

.td-cell {
    white-space: nowrap;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #334155;
}

body {
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

#sidebar {
    width: 16rem;
    overflow: hidden;
    transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar-inner,
.main-scroll {
    overscroll-behavior: contain;
}

.main-scroll {
    overflow-x: hidden;
}

#salesChart {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

#salesChart .apexcharts-canvas,
#salesChart .apexcharts-svg {
    max-width: 100% !important;
}

.sidebar-inner {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-inner::-webkit-scrollbar {
    display: none;
}

.sidebar-label,
.sidebar-title {
    overflow: hidden;
    white-space: nowrap;
    max-width: 12rem;
    opacity: 1;
    transition: opacity 0.18s ease, max-width 0.25s ease;
}

.sidebar-section {
    display: grid;
    grid-template-rows: auto 1fr;
    transition: grid-template-rows 0.28s ease;
}

.sidebar-section.is-collapsed {
    grid-template-rows: auto 0fr;
}

.sidebar-section-items {
    min-height: 0;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sidebar-section.is-collapsed .sidebar-section-items {
    opacity: 0;
}

.sidebar-section-chevron {
    transition: transform 0.28s ease;
}

.sidebar-section.is-collapsed .sidebar-section-chevron {
    transform: rotate(180deg);
}

html.sidebar-preload #sidebar,
html.sidebar-preload .sidebar-label,
html.sidebar-preload .sidebar-title,
html.sidebar-preload .sidebar-section,
html.sidebar-preload .sidebar-section-items,
html.sidebar-preload .sidebar-section-chevron {
    transition: none !important;
}

@media (max-width: 1023px) {
    #sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-open #sidebar {
        transform: translateX(0);
    }
}

.sidebar-header {
    border-right: 1px solid #94a3b8;
}

.sidebar-search-input {
    height: 2.125rem;
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.sidebar-search-input::placeholder {
    color: #64748b;
}

.sidebar-search-input:focus,
.sidebar-search-input:focus-visible {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-primary) 25%, transparent);
}

.sidebar-search-input::-webkit-search-cancel-button {
    filter: invert(0.8);
}

.sidebar-inner>.sidebar-section:first-of-type>[data-section-toggle] {
    padding-top: 0;
}

.sidebar-logo-icon {
    display: none;
}

html.sidebar-collapsed #sidebar,
body.sidebar-collapsed #sidebar {
    width: 4.5rem;
}

html.sidebar-collapsed .sidebar-header,
body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

html.sidebar-collapsed .sidebar-logo-full,
body.sidebar-collapsed .sidebar-logo-full {
    display: none;
}

html.sidebar-collapsed .sidebar-logo-icon,
body.sidebar-collapsed .sidebar-logo-icon {
    display: block;
}

html.sidebar-collapsed .sidebar-search,
body.sidebar-collapsed .sidebar-search {
    display: none;
}

html.sidebar-collapsed .sidebar-label,
html.sidebar-collapsed .sidebar-title,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-title {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
}

html.sidebar-collapsed #chatUnreadBadge,
body.sidebar-collapsed #chatUnreadBadge {
    position: absolute;
    top: 0.2rem;
    right: 0.45rem;
    margin-left: 0;
    opacity: 1;
    max-width: none;
    pointer-events: none;
}

.sidebar-overlay {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

.modal-root {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-root.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-root .modal-backdrop {
    transition: opacity 0.2s ease;
}

.modal-box,
.modal-box-sm,
.modal-box-md,
.modal-box-lg,
.command-palette {
    transform: translateY(10px) scale(0.98);
    transition: transform 0.22s ease;
}

.modal-root.is-open .modal-box,
.modal-root.is-open .modal-box-sm,
.modal-root.is-open .modal-box-md,
.modal-root.is-open .modal-box-lg,
.modal-root.is-open .command-palette {
    transform: translateY(0) scale(1);
}

[data-dropdown-menu] {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

[data-dropdown-menu].is-open {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notyf__toast {
    border-radius: 12px;
    max-width: 360px;
    background: #0f172a;
    color: #f8fafc;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35);
}

.notyf__message {
    font-size: 0.875rem;
    font-weight: 500;
    color: #f8fafc;
}

.notyf__icon i {
    font-size: 1.2rem;
    line-height: 1;
}

.notyf__toast--dismissible .notyf__wrapper {
    padding-right: 40px;
}

.notyf__dismiss {
    width: 36px;
    margin-right: 0;
    right: 0;
}

.notyf__dismiss-btn {
    width: 22px;
    height: 22px;
    margin: auto 0;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.12);
}

.notyf__dismiss-btn:after,
.notyf__dismiss-btn:before {
    background: #cbd5e1;
}

.ts-wrapper {
    width: 100%;
}

.ts-wrapper.field {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.ts-wrapper.w-auto {
    width: auto;
    min-width: 9rem;
}

.ts-wrapper .ts-control {
    min-height: 2.375rem;
    height: 2.375rem;
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
    box-shadow: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #1e293b;
    overflow: hidden;
    flex-wrap: nowrap;
    align-items: center;
}

select.field {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    cursor: pointer;
    outline: none;
    box-shadow: none;
}

select.field:focus,
select.field:focus-visible {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-primary) 20%, transparent);
}

.ts-wrapper.single .ts-control {
    padding-right: 2.25rem;
    cursor: pointer;
}

.ts-wrapper.single .ts-control>div.item {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
}

.ts-wrapper.single .ts-control>input {
    min-width: 0 !important;
}

body>.ts-dropdown .dropdown-input {
    border: 0;
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 12px;
    font-size: 0.875rem;
    color: #1e293b;
    outline: none;
    box-shadow: none;
}

body>.ts-dropdown .dropdown-input:focus {
    outline: none;
    border-bottom-color: var(--brand-primary);
}

.ts-wrapper.single .ts-control::after {
    content: "\ea5f";
    font-family: "tabler-icons";
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    line-height: 1;
    color: #64748b;
    pointer-events: none;
    transition: transform 0.16s ease;
}

.ts-wrapper.single.dropdown-active .ts-control::after {
    transform: translateY(-50%) rotate(180deg);
}

.ts-wrapper.focus .ts-control,
.ts-wrapper .ts-control:focus,
.ts-wrapper .ts-control:focus-visible {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-primary) 20%, transparent);
}

.ts-wrapper .ts-control input {
    font-size: 0.875rem;
    color: #1e293b;
}

.ts-dropdown {
    margin: 6px 0 0;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    z-index: 80;
    animation: ts-drop 0.16s ease;
}

.ts-dropdown-content {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.ts-dropdown-content::-webkit-scrollbar {
    width: 4px;
}

.ts-dropdown-content::-webkit-scrollbar-track {
    background: transparent;
}

.ts-dropdown-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

body>.ts-dropdown {
    position: fixed;
    margin-top: 0;
}

.ts-dropdown .option,
.ts-dropdown .no-results,
.ts-dropdown .optgroup-header {
    padding: 8px 12px;
    border-radius: 0.5rem;
    border: 0;
    outline: none;
    box-shadow: none;
    font-size: 0.875rem;
}

.ts-dropdown .option.active,
.ts-dropdown .active {
    background: var(--brand-secondary);
    color: var(--brand-primary-dark);
    outline: none;
    border: 0;
    box-shadow: none;
}

.ts-dropdown .option.selected,
.ts-dropdown .selected {
    background: var(--brand-primary);
    color: #fff;
    outline: none;
    border: 0;
    box-shadow: none;
}

.ts-dropdown .option.selected.active {
    background: var(--brand-primary-dark);
    color: #fff;
}

.ts-dropdown [data-selectable] .highlight {
    background: color-mix(in srgb, var(--brand-primary) 20%, transparent);
    color: inherit;
}

.js-row-detail {
    cursor: pointer;
}

.record-offcanvas {
    position: fixed;
    inset: 0;
    z-index: 60;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.record-offcanvas.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.record-offcanvas-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.record-offcanvas-panel {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 28rem;
    height: 100%;
    background: #fff;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
    transform: translateX(100%);
    transition: transform 0.24s ease, max-width 0.24s ease;
}

.record-offcanvas-panel.is-cols-2 {
    max-width: 48rem;
}

.record-offcanvas-panel.is-cols-3 {
    max-width: 72rem;
}

.record-offcanvas.is-open .record-offcanvas-panel {
    transform: translateX(0);
}

#recordOffcanvasBody {
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#recordOffcanvasBody::-webkit-scrollbar {
    display: none;
}

.record-field-grid {
    display: grid;
    grid-template-columns: 1fr;
    column-gap: 1.5rem;
}

.record-offcanvas-panel.is-cols-2 .record-field-grid {
    grid-template-columns: 1fr 1fr;
}

.record-offcanvas-panel.is-cols-3 .record-field-grid {
    grid-template-columns: 1fr 1fr 1fr;
}

.record-field-row {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
    align-content: start;
}

.record-offcanvas-panel.is-cols-2 .record-field-row,
.record-offcanvas-panel.is-cols-3 .record-field-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
}

@media (max-width: 767px) {

    .record-offcanvas-panel.is-cols-2,
    .record-offcanvas-panel.is-cols-3 {
        max-width: 100%;
    }

    .record-offcanvas-panel.is-cols-2 .record-field-grid,
    .record-offcanvas-panel.is-cols-3 .record-field-grid {
        grid-template-columns: 1fr;
    }

    .record-offcanvas-panel.is-cols-2 .record-field-row,
    .record-offcanvas-panel.is-cols-3 .record-field-row {
        grid-template-columns: 8.5rem 1fr;
        gap: 0.75rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .record-offcanvas-panel.is-cols-3 {
        max-width: 48rem;
    }

    .record-offcanvas-panel.is-cols-3 .record-field-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.record-log-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    background: #f8fafc;
}

.file-drop {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 4.5rem;
    padding: 0.75rem 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 0.75rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.file-drop:hover,
.file-drop:focus-within {
    border-color: var(--brand-primary);
    background: color-mix(in srgb, var(--brand-primary) 5%, white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 12%, transparent);
}

.file-drop.has-file {
    border-style: solid;
    border-color: #86efac;
    background: #f0fdf4;
}

.file-drop-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-drop-icon {
    display: inline-flex;
    height: 2.5rem;
    width: 2.5rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: #f1f5f9;
    color: #64748b;
    font-size: 1.25rem;
}

.file-drop.has-file .file-drop-icon {
    background: #dcfce7;
    color: #15803d;
}

.file-drop-copy {
    min-width: 0;
    flex: 1;
}

.file-drop-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
}

.file-drop-hint {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: #64748b;
}

.file-drop-btn {
    flex-shrink: 0;
    border-radius: 0.5rem;
    background: #0f172a;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    pointer-events: none;
}

.file-drop img.file-drop-avatar {
    height: 3rem;
    width: 3rem;
    flex-shrink: 0;
    border-radius: 9999px;
    object-fit: cover;
    background: #fff;
}

.file-drop img.file-drop-logo {
    height: 3rem;
    width: 3rem;
    flex-shrink: 0;
    border-radius: 0.5rem;
    object-fit: contain;
    background: #fff;
}

.file-drop img.file-drop-favicon {
    height: 3rem !important;
    width: 3rem !important;
    max-height: 3rem;
    max-width: 3rem;
    flex-shrink: 0;
    border-radius: 0.5rem;
    object-fit: contain;
    background: #fff;
}

.file-drop img.file-drop-background {
    height: 4rem !important;
    width: 7rem !important;
    max-height: 4rem;
    max-width: 7rem;
    flex-shrink: 0;
    border-radius: 0.5rem;
    object-fit: cover;
    background: #fff;
}

@keyframes ts-drop {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

html *:focus,
html *:focus-visible {
    outline: none;
}

.btn-primary:focus,
.btn-primary:focus-visible,
.btn-secondary:focus,
.btn-secondary:focus-visible,
.btn-ghost:focus,
.btn-ghost:focus-visible,
.btn-danger:focus,
.btn-danger:focus-visible,
a:focus,
a:focus-visible,
button:focus,
button:focus-visible {
    outline: none;
}

.btn-primary:focus-visible,
.btn-danger:focus-visible,
.btn-export-pdf:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-primary) 30%, transparent);
}

.btn-export-excel:focus-visible {
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.35);
}

.btn-secondary:focus-visible,
.btn-ghost:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-primary) 20%, transparent);
}

.ts-wrapper .ts-control,
.ts-wrapper .ts-control input,
.ts-wrapper .ts-control input:focus,
.ts-wrapper .ts-control input:focus-visible {
    outline: none !important;
    box-shadow: none;
}

.ts-wrapper.focus .ts-control {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-primary) 20%, transparent);
}

.ts-dropdown .option.active,
.ts-dropdown .active {
    background: var(--brand-secondary) !important;
    color: var(--brand-primary-dark) !important;
    outline: none;
    border: 0;
    box-shadow: none;
}

.ts-dropdown .option.selected,
.ts-dropdown .selected {
    background: var(--brand-primary) !important;
    color: #fff !important;
}

.ts-dropdown .option.selected.active {
    background: var(--brand-primary-dark) !important;
    color: #fff !important;
}

select option:checked {
    background-color: var(--brand-primary);
    color: #fff;
}

.login-brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 2rem;
}

.login-page,
.login-panel,
.login-panel footer {
    background: #fdfdff;
}

.login-panel footer {
    border-color: #eef0f4;
}

html:has(body.h-screen) {
    height: 100%;
    overflow: hidden;
}

body.h-screen {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.login-logo {
    display: block;
    height: 3.25rem;
    width: auto;
    max-width: 17rem;
    object-fit: contain;
    object-position: left center;
}

.login-hero {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.72) 0%, rgba(15, 23, 42, 0.88) 100%);
}

.login-hero-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.35);
}

.login-hero-card i {
    font-size: 1.15rem;
    line-height: 1;
    color: #fca5a5;
    margin-top: 0.1rem;
}

.login-hero-card p {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.login-hero-card span {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    line-height: 1.35;
    color: #cbd5e1;
}

.ui-tooltip {
    position: fixed;
    z-index: 90;
    padding: 0.3rem 0.55rem;
    border-radius: 0.375rem;
    background: #0f172a;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, calc(-100% - 8px));
    transition: opacity 0.12s ease;
}

.ui-tooltip.is-show {
    opacity: 1;
}

.ui-tooltip.is-below {
    transform: translate(-50%, 8px);
}

.ui-tooltip.is-help {
    max-width: 18rem;
    white-space: normal;
    font-weight: 400;
    line-height: 1.4;
    text-align: left;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.startRange.prevMonthDay,
.flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.startRange.nextMonthDay,
.flatpickr-day.endRange.nextMonthDay {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.flatpickr-day.inRange,
.flatpickr-day.prevMonthDay.inRange,
.flatpickr-day.nextMonthDay.inRange,
.flatpickr-day.today.inRange,
.flatpickr-day.prevMonthDay.today.inRange,
.flatpickr-day.nextMonthDay.today.inRange {
    background: var(--brand-secondary);
    border-color: var(--brand-secondary);
    box-shadow: -5px 0 0 var(--brand-secondary), 5px 0 0 var(--brand-secondary);
    color: var(--brand-primary-dark);
}

.flatpickr-day.today {
    border-color: var(--brand-primary);
}

.flatpickr-day.today:hover,
.flatpickr-day.today:focus {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.flatpickr-day:hover {
    background: var(--brand-secondary);
    border-color: var(--brand-secondary);
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: var(--brand-primary);
}

.chat-head-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.375rem;
}

.chat-head-btn {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.75rem;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.chat-head-btn.is-audio {
    background: #ecfdf5;
    color: #047857;
}

.chat-head-btn.is-audio:hover {
    background: #059669;
    color: #fff;
}

.chat-head-btn.is-video {
    background: #eff6ff;
    color: #1d4ed8;
}

.chat-head-btn.is-video:hover {
    background: #2563eb;
    color: #fff;
}

.chat-head-btn.is-search {
    background: #f1f5f9;
    color: #334155;
}

.chat-head-btn.is-search:hover,
.chat-head-btn.is-search.is-on {
    background: #0f172a;
    color: #fff;
}

.chat-main-head {
    position: relative;
    flex-shrink: 0;
}

.chat-msg-search {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 6;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.06);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.chat-msg-search.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
}

.chat-pin-bar {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    background: #fff7ed;
    padding: 0.4rem 0.6rem;
}

.chat-pin-bar.is-off {
    display: none;
}

.chat-pin-jump {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: 0.5rem;
    border: 0;
    background: transparent;
    color: #9a3412;
    cursor: pointer;
    text-align: left;
}

.chat-load-older {
    display: block;
    width: 100%;
    margin-bottom: 0.5rem;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 0.75rem;
    cursor: pointer;
}

.chat-load-older.is-off {
    display: none;
}

.chat-unread-sep {
    margin: 0.5rem 0;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #e11d48;
}

.chat-jump-bottom {
    position: absolute;
    right: 1rem;
    bottom: 5.5rem;
    z-index: 8;
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
    cursor: pointer;
}

.chat-jump-bottom.is-off {
    display: none;
}

.chat-jump-count {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: var(--brand-primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
}

.chat-jump-count.is-off {
    display: none;
}

.chat-mention {
    font-weight: 700;
    color: #0369a1;
}

.chat-msg-row.justify-end .chat-mention {
    color: #7dd3fc;
}

.chat-mention-list {
    position: absolute;
    right: 0.75rem;
    bottom: 3.4rem;
    left: 0.75rem;
    z-index: 9;
    max-height: 10rem;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.chat-mention-list.is-off {
    display: none;
}

.chat-mention-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.chat-mention-item:hover {
    background: #f8fafc;
}

.chat-reply-quote {
    display: block;
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.chat-forwarded-label {
    margin-bottom: 0.25rem;
    font-size: 0.7rem;
    opacity: 0.7;
}

.chat-msg-row.is-flash .chat-msg-bubble {
    box-shadow: 0 0 0 2px #fb7185;
}

.chat-msg-action.is-star {
    border-color: #fde68a;
    background: #fffbeb;
    color: #d97706;
}

.chat-voice-wave {
    display: flex;
    height: 1.1rem;
    flex: 1;
    align-items: flex-end;
    gap: 0.12rem;
}

.chat-voice-wave i {
    display: block;
    width: 0.16rem;
    height: 35%;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.7;
}

.chat-voice-wave i:nth-child(2),
.chat-voice-wave i:nth-child(8) {
    height: 55%;
}

.chat-voice-wave i:nth-child(3),
.chat-voice-wave i:nth-child(7) {
    height: 80%;
}

.chat-voice-wave i:nth-child(4),
.chat-voice-wave i:nth-child(6) {
    height: 45%;
}

.chat-voice-wave i:nth-child(5) {
    height: 95%;
}

.chat-voice-wave i:nth-child(9) {
    height: 60%;
}

.chat-voice-wave i:nth-child(10) {
    height: 30%;
}

.chat-voice.is-playing .chat-voice-wave i {
    animation: chat-wave 0.8s ease-in-out infinite;
}

.chat-voice.is-playing .chat-voice-wave i:nth-child(odd) {
    animation-delay: 0.15s;
}

@keyframes chat-wave {

    0%,
    100% {
        transform: scaleY(0.45);
    }

    50% {
        transform: scaleY(1);
    }
}

.chat-info-photo {
    display: block;
    overflow: hidden;
    aspect-ratio: 1;
    border-radius: 0.4rem;
    background: #f1f5f9;
}

.chat-info-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-info-file,
.chat-info-star,
.chat-forward-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.5rem;
    border: 0;
    border-radius: 0.5rem;
    background: #f8fafc;
    color: #334155;
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
}

.chat-info-star {
    color: #d97706;
}

.chat-seen-pop {
    position: fixed;
    z-index: 40;
    min-width: 8rem;
    max-width: 14rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    font-size: 0.75rem;
    color: #334155;
}

.chat-seen-pop.is-off {
    display: none;
}

.chat-call-action.is-screen {
    background: rgba(255, 255, 255, 0.14);
}

#chatMain {
    position: relative;
    min-width: 0;
}

#chatForm {
    position: relative;
}

.chat-shell {
    min-width: 0;
    height: calc(100dvh - 11rem);
}

@media (max-width: 1023px) {
    .chat-shell {
        height: calc(100dvh - 12rem);
    }
}

.chat-head-btn.is-info {
    background: #fff7ed;
    color: #c2410c;
}

.chat-head-btn.is-info:hover {
    background: #ea580c;
    color: #fff;
}

.chat-info-panel {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    width: 0;
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border-left: 1px solid transparent;
    opacity: 0;
    pointer-events: none;
    transition: width 0.28s ease, opacity 0.2s ease, border-color 0.28s ease, transform 0.28s ease;
}

.chat-info-panel.is-open {
    width: 20rem;
    border-left-color: #f1f5f9;
    opacity: 1;
    pointer-events: auto;
}

.chat-info-inner {
    display: flex;
    height: 100%;
    min-height: 0;
    width: 20rem;
    flex-direction: column;
    overflow-y: auto;
}

@media (max-width: 767px) {
    .main-scroll:has(.chat-page) {
        overflow: hidden;
    }

    .main-scroll:has(.chat-page)>footer {
        display: none;
    }

    main:has(.chat-page) {
        display: flex;
        flex: 1;
        min-height: 0;
        flex-direction: column;
        overflow: hidden;
        padding: 0;
    }

    .chat-page {
        display: flex;
        flex: 1;
        min-height: 0;
        flex-direction: column;
        height: 100%;
    }

    .chat-page-head {
        flex-shrink: 0;
        padding: 1rem 1rem 0;
    }

    .chat-shell {
        flex: 1;
        min-height: 0;
        height: auto;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
    }

    .chat-head-actions {
        gap: 0.25rem;
    }

    .chat-main-head>.flex {
        min-width: 0;
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .chat-head-btn {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
        border-radius: 0.5rem;
        box-shadow: none;
    }

    .chat-main-head .btn-ghost {
        flex-shrink: 0;
        padding: 0.35rem;
    }

    .chat-main-head img.h-10,
    .chat-main-head span.h-10 {
        width: 2.25rem;
        height: 2.25rem;
    }

    .chat-composer {
        gap: 0.25rem;
    }

    .chat-composer-btn,
    .chat-composer-send {
        width: 2.125rem;
        height: 2.125rem;
        font-size: 1rem;
    }

    .chat-composer-input {
        height: 2.125rem;
        min-height: 2.125rem;
        font-size: 1rem;
    }

    #chatForm {
        padding: 0.5rem 0.6rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    }

    #chatMessages {
        padding: 0.75rem;
    }

    .chat-msg-col {
        width: auto;
        max-width: 88%;
    }

    .chat-msg-bubble img {
        max-width: 100%;
        height: auto;
    }

    .chat-msg-actions {
        flex-wrap: wrap;
        max-width: 100%;
        opacity: 1;
        pointer-events: auto;
    }

    .chat-voice {
        min-width: 0;
        max-width: 100%;
    }

    .chat-call-log {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .chat-call-overlay {
        position: fixed;
        z-index: 70;
    }

    .chat-call-video-wrap video#chatCallLocal {
        right: 0.75rem;
        bottom: 0.75rem;
        width: 5.5rem;
        height: 4rem;
    }

    .chat-info-panel {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 20;
        width: 100%;
        border-left: none;
        opacity: 1;
        box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
        transform: translateX(100%);
    }

    .chat-info-panel.is-open {
        width: 100%;
        transform: translateX(0);
    }

    .chat-info-inner {
        width: 100%;
    }
}

.chat-composer {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.chat-composer-btn,
.chat-composer-send {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 2.375rem;
    height: 2.375rem;
    padding: 0;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
}

.chat-composer-btn {
    border: 0;
    background: #f1f5f9;
    color: #334155;
}

.chat-composer-btn.is-emoji {
    background: #fefce8;
    color: #ca8a04;
}

.chat-composer-btn.is-emoji:hover {
    background: #eab308;
    color: #fff;
}

.chat-composer-btn.is-file {
    background: #f5f3ff;
    color: #6d28d9;
}

.chat-composer-btn.is-file:hover {
    background: #7c3aed;
    color: #fff;
}

.chat-composer-btn.is-mic {
    background: #d1fae5;
    color: #047857;
}

.chat-composer-btn.is-mic:hover {
    background: #059669;
    color: #fff;
}

.chat-composer-btn:hover {
    background: #0f172a;
    color: #fff;
}

.chat-composer-send {
    border: 1px solid var(--brand-primary);
    background: var(--brand-primary);
    color: #fff;
}

.chat-composer-send:hover {
    background: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
}

@media (max-width: 767px) {

    .chat-composer-btn.is-emoji,
    .chat-composer-btn.is-file,
    .chat-composer-btn.is-mic {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }
}

.chat-composer-input {
    box-sizing: border-box;
    width: auto;
    flex: 1 1 auto;
    height: 2.375rem;
    min-height: 2.375rem;
    max-height: 8rem;
    resize: none;
    line-height: 1.25rem;
}

.chat-msg-actions {
    display: flex;
    gap: 0.125rem;
    margin-top: 0.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.chat-msg-actions.is-mine {
    justify-content: flex-end;
}

.group:hover .chat-msg-actions,
.chat-msg-row:hover .chat-msg-actions {
    opacity: 1;
    pointer-events: auto;
}

.chat-msg-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: #fff;
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.chat-msg-action:hover {
    background: #f8fafc;
    color: #0f172a;
}

.chat-msg-action.is-danger:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: #dc2626;
}

.chat-msg-action.is-heart {
    border-color: #fecdd3;
    background: #fff1f2;
    color: #e11d48;
}

.chat-msg-col {
    display: flex;
    flex-direction: column;
    width: max-content;
    max-width: 80%;
    align-items: flex-start;
}

.chat-msg-row.justify-end .chat-msg-col {
    align-items: flex-end;
}

.chat-msg-wrap {
    position: relative;
    width: fit-content;
    max-width: 100%;
}

.chat-msg-bubble {
    width: fit-content;
    max-width: 100%;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.chat-msg-wrap.has-heart {
    padding-bottom: 0.55rem;
}

.chat-heart-badge {
    position: absolute;
    z-index: 2;
    bottom: -0.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.28rem;
    border: 1px solid #f1f5f9;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
    line-height: 1;
    cursor: pointer;
}

.chat-heart-badge.is-off,
.chat-heart-count.is-off {
    display: none;
}

.chat-msg-row.justify-start .chat-heart-badge {
    right: -0.2rem;
}

.chat-msg-row.justify-end .chat-heart-badge {
    left: -0.2rem;
}

.chat-heart-emoji {
    font-size: 0.78rem;
}

.chat-heart-count {
    font-size: 0.65rem;
    font-weight: 700;
    color: #e11d48;
}

.chat-heart-badge.is-pop {
    animation: chat-heart-pop 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

.chat-heart-burst {
    position: absolute;
    left: 50%;
    bottom: 0.4rem;
    z-index: 3;
    font-size: 1.45rem;
    pointer-events: none;
    animation: chat-heart-float 0.7s ease-out forwards;
}

@keyframes chat-heart-pop {
    0% {
        transform: scale(0.35);
    }

    55% {
        transform: scale(1.28);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes chat-heart-float {
    0% {
        opacity: 1;
        transform: translate(-50%, 0) scale(0.55);
    }

    40% {
        opacity: 1;
        transform: translate(-50%, -18px) scale(1.25);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -44px) scale(1);
    }
}

.chat-voice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 9rem;
    margin-bottom: 0.25rem;
    padding: 0.25rem 0.6rem 0.25rem 0.25rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
}

.chat-msg-row.justify-start .chat-voice {
    background: #f1f5f9;
}

.chat-msg-row .chat-voice-play {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
}

.chat-msg-row .chat-voice-play i {
    color: #0f172a;
    font-size: 0.95rem;
}

.chat-msg-row.justify-start .chat-voice-play {
    background: #0f172a;
}

.chat-msg-row.justify-start .chat-voice-play i {
    color: #fff;
}

.chat-voice-time {
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.chat-record-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--brand-primary);
    animation: chat-record-pulse 1s ease-in-out infinite;
}

@keyframes chat-record-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

.chat-call-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: none;
    flex-direction: column;
    background: #0f172a;
    color: #fff;
}

.chat-call-overlay.is-open {
    display: flex;
}

.chat-call-head {
    padding: 1.25rem 1rem 0.5rem;
    text-align: center;
}

.chat-call-video-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #020617;
}

.chat-call-video-wrap video#chatCallRemote {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #020617;
}

.chat-call-video-wrap video#chatCallLocal {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    width: 7.5rem;
    height: 5.5rem;
    object-fit: cover;
    border-radius: 0.75rem;
    background: #1e293b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.chat-call-stage {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
}

.chat-call-avatar,
.chat-call-avatar-fallback {
    width: 6.5rem;
    height: 6.5rem;
    border-radius: 999px;
    object-fit: cover;
}

.chat-call-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 600;
    color: #fff;
}

.chat-call-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem 1.5rem;
}

.chat-call-action {
    display: inline-flex;
    width: 3.25rem;
    height: 3.25rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.chat-call-action.is-mute,
.chat-call-action.is-cam,
.chat-call-action.is-screen {
    background: rgba(255, 255, 255, 0.14);
}

.chat-call-action.is-on {
    background: #fff;
    color: #0f172a;
}

.chat-call-action.is-hangup,
.chat-call-action.is-reject {
    background: var(--brand-primary);
}

.chat-call-action.is-accept {
    background: #16a34a;
}

.chat-incoming-call {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.72);
}

.chat-incoming-call.is-open {
    display: flex;
}

.chat-incoming-card {
    width: 100%;
    max-width: 20rem;
    border-radius: 1.25rem;
    background: #0f172a;
    color: #fff;
    padding: 1.75rem 1.25rem 1.5rem;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.chat-incoming-icon {
    display: inline-flex;
    width: 3.5rem;
    height: 3.5rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    border-radius: 999px;
    background: rgba(22, 163, 74, 0.18);
    color: #4ade80;
    font-size: 1.5rem;
}

.chat-call-log {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    max-width: 22rem;
    margin: 0.5rem auto;
    padding: 0.75rem 0.9rem;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.chat-call-log-icon {
    display: inline-flex;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #ecfdf5;
    color: #059669;
    font-size: 1.05rem;
}

.chat-call-log.is-missed .chat-call-log-icon,
.chat-call-log.is-declined .chat-call-log-icon,
.chat-call-log.is-failed .chat-call-log-icon {
    background: #fff1f2;
    color: #e11d48;
}

.chat-call-log.is-cancelled .chat-call-log-icon {
    background: #f8fafc;
    color: #64748b;
}

.chat-call-log-body {
    min-width: 0;
    flex: 1;
}

.chat-call-log-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
}

.chat-call-log-meta {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: #475569;
}

.chat-call-log-status {
    font-weight: 600;
}

.chat-call-log.is-completed .chat-call-log-status {
    color: #059669;
}

.chat-call-log.is-missed .chat-call-log-status,
.chat-call-log.is-declined .chat-call-log-status,
.chat-call-log.is-failed .chat-call-log-status {
    color: #e11d48;
}

.chat-call-log-detail {
    margin: 0.1rem 0 0;
    font-size: 0.72rem;
    color: #64748b;
}

.chat-call-log-time {
    margin: 0.35rem 0 0;
    font-size: 0.68rem;
    color: #94a3b8;
}

#commandPalette.modal-root {
    align-items: flex-start;
    padding-top: 12vh;
}

.command-palette {
    display: flex;
    max-height: min(32rem, calc(100vh - 16vh));
    flex-direction: column;
}

.command-palette-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.9rem 1rem;
}

.command-palette-search-icon {
    font-size: 1.15rem;
    color: #94a3b8;
}

.command-palette-input {
    min-width: 0;
    flex: 1;
    border: 0;
    background: transparent;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #0f172a;
    outline: none;
}

.command-palette-input::placeholder {
    color: #94a3b8;
}

.command-palette-esc {
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background: #f8fafc;
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.command-palette-list {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.5rem;
}

.command-group {
    margin-bottom: 0.35rem;
}

.command-group:last-of-type {
    margin-bottom: 0;
}

.command-group-title {
    padding: 0.45rem 0.7rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.command-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border-radius: 0.7rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.875rem;
    color: #334155;
}

.command-item-icon {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 0.55rem;
    background: #f1f5f9;
    color: #475569;
    font-size: 1rem;
}

.command-item-label {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-item-meta {
    flex-shrink: 0;
    font-size: 0.95rem;
    color: #cbd5e1;
}

.command-item.is-current .command-item-meta {
    color: var(--brand-primary);
}

.command-item.is-active {
    background: var(--brand-secondary);
    color: var(--brand-primary-dark);
}

.command-item.is-active .command-item-icon {
    background: #fff;
    color: var(--brand-primary);
}

.command-item.is-active .command-item-meta {
    color: var(--brand-primary);
}

.command-palette-empty {
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: #94a3b8;
}

.command-palette-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    padding: 0.55rem 1rem;
    font-size: 0.72rem;
    color: #64748b;
}

.command-palette-footer kbd {
    display: inline-flex;
    min-width: 1.2rem;
    align-items: center;
    justify-content: center;
    margin-right: 0.15rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.3rem;
    background: #fff;
    padding: 0.05rem 0.3rem;
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 600;
    color: #475569;
}

.htmx-indicator {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request {
    opacity: 1;
}

.htmx-progress {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    height: 2px;
    width: 100%;
    background: var(--brand-primary);
    transform-origin: left center;
    animation: htmx-progress 0.9s ease-in-out infinite;
}

@keyframes htmx-progress {
    0% {
        transform: scaleX(0.12);
    }

    50% {
        transform: scaleX(0.72);
    }

    100% {
        transform: scaleX(1);
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.offline-page {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #0f172a;
}

.offline-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.offline-overlay.hidden,
.offline-overlay[hidden] {
    display: none;
}

.offline-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px;
}

.offline-illustration {
    width: min(280px, 72vw);
    margin-bottom: 8px;
}

.offline-illustration svg {
    display: block;
    width: 100%;
    height: auto;
}

.offline-title {
    margin: 8px 0 0;
    font-size: 1.375rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.offline-text {
    margin: 8px 0 0;
    max-width: 22rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #64748b;
}

.offline-retry {
    margin-top: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 6.5rem;
    height: 2.375rem;
    padding: 0 1.25rem;
    border: 0;
    border-radius: 9999px;
    background: var(--brand-primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.offline-retry:hover {
    background: var(--brand-primary-dark);
}

.offline-retry:disabled {
    opacity: 0.65;
    cursor: wait;
}