/* TicketDetailDialog — Jira-inspired modern detail surface (matches TaskDetailDialog). */

.ticket-dialog {
    /* Outer Radzen dialog (CssClass="dalatic-detail-dialog") controls
       size + radius + background. The inner wrapper only lays out the
       main column and sidebar. Pre-fix it had its own 18px radius +
       1200px cap, so on a 1400px outer dialog it rendered as a nested
       inset card with blank margins — "caja sobre otra" in the
       user's words. */
    display: flex;
    gap: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Full-page variant — when the component is embedded in
   /tickets/{id} or /admin/tickets/{id} (not launched via
   DialogService), the outer wrapper fills the viewport so the
   ticket surface occupies the whole page. The sidebar becomes
   static: it renders in one go, no internal scroll, all fields
   (SLA card, Details, Dates, Watchers) visible at once. The main
   column on the left still scrolls independently so the comment
   thread doesn't push the sidebar around. */
.ticket-dialog--fullpage {
    height: calc(100vh - 1.5rem);
    min-height: 600px;
}
.ticket-dialog--fullpage .ticket-sidebar {
    max-height: none;
    overflow-y: visible;
}
.ticket-dialog--fullpage .ticket-main {
    overflow-y: auto;
}

/* Writer mode — dialog transforms in place.
   Sidebar slides out, body collapses, editor fills the main area.
   No second overlay; the dialog itself is the writing surface. */

.ticket-dialog--writer .ticket-sidebar {
    width: 0;
    min-width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.28s ease;
}

.ticket-dialog--writer .ticket-main {
    overflow: hidden;
}

.ticket-dialog--writer .ticket-breadcrumb {
    display: none;
}

.ticket-dialog--writer .ticket-body {
    display: none;
}

.ticket-dialog--writer .activity-tabs {
    display: none;
}

.ticket-dialog--writer .activity-section {
    flex: 1;
    min-height: 0;
    margin-top: 0;
    padding-top: 0.75rem;
    border-top: none;
    display: flex;
    flex-direction: column;
}

.ticket-dialog--writer .comment-input-wrapper {
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

.ticket-dialog--writer .comment-avatar {
    display: none;
}

.ticket-dialog--writer .comment-input-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Loading / empty variants — keep the same footprint as the real dialog so
   nothing jumps when data arrives. The skeleton / empty content fills the
   wrapper directly; no intermediate padded box that would look like
   "two cards" when the DetailSkeleton already carries its own padding. */
.ticket-dialog--loading {
    align-items: stretch;
    justify-content: stretch;
    min-height: 500px;
    flex-direction: column;
}

.ticket-dialog-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

/* MAIN CONTENT */
.ticket-main {
    flex: 1;
    padding: 1.625rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    border-right: 1px solid var(--rz-base-200);
    min-width: 0;
    background: var(--rz-base-background-color);
}

.ticket-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--rz-text-tertiary-color);
}

.ticket-breadcrumb a {
    color: var(--rz-primary);
    text-decoration: none;
}

.ticket-breadcrumb a:hover {
    text-decoration: underline;
}

.ticket-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--rz-base-background-color);
    padding: 0.5rem 0 0.75rem;
    margin: -0.5rem 0 0;
    border-bottom: 1px solid var(--rz-base-200);
}

.ticket-open-full {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: transparent;
    border: 1px solid var(--rz-base-300);
    border-radius: 6px;
    color: var(--rz-text-secondary-color);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ticket-open-full:hover {
    background: var(--rz-base-100);
    border-color: var(--rz-primary-lighter);
    color: var(--rz-primary);
}

.ticket-open-full .rzi { font-size: 0.875rem; }

.ticket-type-badge {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ticket-type-badge .material-icons {
    font-size: 14px;
    color: white;
}

.ticket-header-content {
    flex: 1;
    min-width: 0;
}

.ticket-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--rz-text-color);
    line-height: 1.4;
    margin: 0;
}

.ticket-title--editable {
    cursor: pointer;
    border-bottom: 1px dashed transparent;
    transition: border-color 0.15s;
}

.ticket-title--editable:hover {
    border-bottom-color: var(--rz-text-tertiary-color);
}

.ticket-title-input {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--rz-text-color);
    line-height: 1.4;
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--rz-primary);
    background: transparent;
    outline: none;
    padding: 0;
    margin: 0;
}

.ticket-number {
    font-size: 0.75rem;
    color: var(--rz-text-tertiary-color);
    margin-top: 0.125rem;
}

/* SECTIONS */
.section-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rz-text-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.section-header .material-icons {
    font-size: 0.875rem;
    color: var(--rz-text-tertiary-color);
}

.description-content {
    padding: 0.25rem 0;
    min-height: 80px;
    font-size: 0.8125rem;
    color: var(--rz-text-secondary-color);
    line-height: 1.6;
    white-space: pre-wrap;
}

.description-content.comment-display-editable {
    cursor: pointer;
}

/* ATTACHMENTS PREVIEW */
.attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.attachment-preview-thumb {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--rz-base-200);
    transition: all 0.15s ease;
}

.attachment-preview-thumb:hover {
    border-color: var(--rz-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.attachment-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-preview-file {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    border-radius: 6px;
    background: var(--rz-base-100);
    border: 1px solid var(--rz-base-200);
    text-decoration: none;
    color: var(--rz-text-color);
    font-size: 0.75rem;
    transition: all 0.15s ease;
    max-width: 180px;
}

.attachment-preview-file:hover {
    background: var(--rz-base-200);
    border-color: var(--rz-primary-lighter);
}

.attachment-preview-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-actions {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--rz-base-200);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.875rem;
    border-radius: 8px;
    border: 1px solid var(--rz-base-300);
    background: var(--rz-base-background-color);
    color: var(--rz-text-color);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    text-align: left;
}

.action-btn:hover {
    background: var(--rz-base-100);
    border-color: var(--rz-base-400);
}

.action-btn.danger {
    color: var(--rz-danger);
}

.action-btn.danger:hover {
    background: var(--rz-danger-lighter);
    border-color: color-mix(in srgb, var(--rz-danger) 35%, var(--rz-base-300));
}

/* AI SUMMARY SECTION */
.ai-summary-section {
    background: var(--rz-base-50);
    border: 1px solid var(--rz-base-200);
    border-radius: 6px;
    padding: 0.75rem;
}

.ai-summary-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.ai-summary-icon {
    color: var(--rz-primary);
    font-size: 1rem;
}

.ai-summary-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rz-primary);
}

.ai-summary-content {
    background: var(--rz-base-background-color);
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--rz-text-secondary-color);
}

.ai-summary-placeholder {
    color: var(--rz-text-tertiary-color);
    font-style: italic;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.7rem;
}

/* COMMENTS SECTION */
.activity-section {
    border-top: 1px solid var(--rz-base-200);
    padding-top: 1rem;
    margin-top: auto;
}

.activity-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--rz-base-200);
    padding-bottom: 0.5rem;
}

.activity-tab {
    padding: 0.375rem 0.75rem;
    border: none;
    background: transparent;
    font-size: 0.8125rem;
    color: var(--rz-text-secondary-color);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.activity-tab:hover {
    background: var(--rz-base-100);
}

.activity-tab.active {
    background: var(--rz-primary-lighter);
    color: var(--rz-primary);
    font-weight: 500;
}

.comment-mode-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--rz-base-300);
    margin-bottom: 0.625rem;
}

.comment-mode-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--rz-text-tertiary-color);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

.comment-mode-tab:hover {
    color: var(--rz-text-color);
}

.comment-mode-tab.active {
    color: var(--rz-primary);
    border-bottom-color: var(--rz-primary);
}

.comment-mode-tab--internal.active {
    color: var(--rz-warning, #f59e0b);
    border-bottom-color: var(--rz-warning, #f59e0b);
}

.comment-input-wrapper {
    display: flex;
    gap: 0.625rem;
    align-items: flex-start;
}

/* Comment policy banners / blocked panels.
   Amber hint shown above the input when commenting will auto-reopen the ticket. */
.comment-will-reopen-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.6rem;
    border-radius: 8px;
    background: color-mix(in srgb, var(--rz-warning) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--rz-warning) 25%, transparent);
    color: var(--rz-text-primary-color);
    font-size: 0.78rem;
    line-height: 1.35;
}

.comment-will-reopen-hint .rzi {
    color: var(--rz-warning) !important;
}

/* Locked / cancelled panels replace the input entirely. */
.comment-blocked-panel {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--rz-base-200);
    background: var(--rz-base-background-color);
}

.comment-blocked-panel--cancelled {
    flex-direction: row;
    align-items: center;
    color: var(--rz-text-tertiary-color);
    font-size: 0.82rem;
    font-style: italic;
}

.comment-blocked-panel--locked {
    background: color-mix(in srgb, var(--rz-base-200) 50%, transparent);
}

.comment-blocked-panel-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--rz-text-primary-color);
    font-size: 0.85rem;
}

.comment-blocked-panel-head .rzi {
    color: var(--rz-text-secondary-color) !important;
}

.comment-blocked-panel-body {
    margin: 0 0 0.35rem 0;
    color: var(--rz-text-secondary-color);
    font-size: 0.78rem;
    line-height: 1.4;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    /* Background set inline via AvatarColors.For(name) so the same
       user keeps the same colour across every surface. Fallback
       below only applies if the inline style is missing. */
    background: var(--rz-base-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    flex-shrink: 0;
}

.comment-input-area {
    flex: 1;
    min-width: 0;
}

.comment-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--rz-base-300);
    border-radius: 6px;
    font-size: 0.8125rem;
    /* Clean white input; no gray-on-gray with the main panel. */
    background: var(--rz-base-background-color);
    color: var(--rz-text-color);
    resize: none;
    min-height: 36px;
    transition: all 0.15s ease;
    font-family: inherit;
}

.comment-char-counter {
    font-size: 0.6875rem;
    text-align: right;
    padding: 0.25rem 0.25rem 0;
    color: var(--rz-text-tertiary-color);
    transition: color 0.2s ease;
}

.comment-char-counter.warning {
    color: var(--rz-warning);
}

.comment-char-counter.danger {
    color: var(--rz-danger);
    font-weight: 500;
}

.comment-input-sending .comment-input {
    opacity: 0.55;
    pointer-events: none;
    cursor: progress;
}

.comment-sending-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.1rem 0;
    font-size: 0.7rem;
    color: var(--rz-text-tertiary-color);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.comment-sending-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    border-top-color: var(--rz-primary);
    border-radius: 50%;
    animation: comment-sending-spin 0.65s linear infinite;
}

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

.comment-input:focus {
    outline: none;
    border-color: var(--rz-primary);
    box-shadow: 0 0 0 2px var(--rz-primary-lighter);
}

.comment-input::placeholder {
    color: var(--rz-text-tertiary-color);
}

.comment-attachment-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.65rem 0 0;
    padding-left: 2.625rem;
}

.comment-attachment-chip {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 180px;
    max-width: 260px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--rz-base-300);
    border-radius: 12px;
    background: color-mix(in srgb, var(--rz-base-100) 85%, white);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.comment-attachment-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 10px;
    flex: 0 0 auto;
    border: 1px solid color-mix(in srgb, var(--rz-base-400) 45%, transparent);
}

.comment-attachment-meta {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.comment-attachment-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--rz-text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comment-attachment-size {
    font-size: 0.75rem;
    color: var(--rz-text-tertiary-color);
}

.comment-attachment-remove {
    border: none;
    background: transparent;
    color: var(--rz-text-tertiary-color);
    cursor: pointer;
    padding: 0.15rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.comment-attachment-remove:hover {
    background: var(--rz-base-200);
    color: var(--rz-danger);
}

.comment-markdown img {
    max-width: min(420px, 100%);
    border-radius: 8px;
    cursor: zoom-in;
}

/* Mention popup styles */
.mention-popup {
    position: absolute;
    top: 100%;
    left: 2.625rem;
    right: 0;
    z-index: 1000;
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-base-300);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s;
}

.mention-item:hover,
.mention-item.selected {
    background: var(--rz-base-100);
}

.mention-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.mention-avatar-initials {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--rz-primary);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mention-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mention-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--rz-text-color);
}

.mention-email {
    font-size: 0.6875rem;
    color: var(--rz-text-tertiary-color);
}

.mention-no-results {
    padding: 0.75rem;
    text-align: center;
    color: var(--rz-text-tertiary-color);
    font-size: 0.75rem;
}

.comment-item {
    /* Flat / blank: the comment text is the content; no gray card
       behind it. Separator between items comes from the thin border
       on the outer column, so the thread reads as a vertical
       stream instead of a stack of tiles. */
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    background: transparent;
    border-radius: 0;
}

/* Right-aligned meta row (date · edited · delete) */
.comment-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Subtle delete button — only fully visible on hover, like the edit affordance */
.comment-delete-btn {
    background: transparent;
    border: none;
    padding: 2px 4px;
    border-radius: 4px;
    color: var(--rz-text-tertiary-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.comment-delete-btn .rzi {
    font-size: 1rem;
    line-height: 1;
}

.comment-item:hover .comment-delete-btn,
.comment-item:focus-within .comment-delete-btn {
    opacity: 1;
}

.comment-delete-btn:hover {
    color: var(--rz-danger, #dc2626);
    background: color-mix(in srgb, var(--rz-danger, #dc2626) 12%, transparent);
}

.comment-delete-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.comment-item-editing {
    border-radius: 6px;
    padding: 0.5rem;
    border: 1px solid var(--rz-primary-lighter);
    background: color-mix(in srgb, var(--rz-primary-lighter) 10%, var(--rz-base-background-color));
}

.comment-display {
    padding: 0.5rem 0.625rem;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.comment-display-editable {
    cursor: text;
    position: relative;
}

.comment-display-editable:hover {
    background: var(--rz-base-background-color);
    border-color: var(--rz-base-300);
}

.comment-display-editable:hover::after {
    content: attr(data-edit-hint);
    position: absolute;
    bottom: 0.35rem;
    right: 0.5rem;
    font-size: 0.7rem;
    line-height: 1;
    color: var(--rz-text-secondary-color);
    background: var(--rz-base-100);
    border: 1px solid var(--rz-base-300);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    pointer-events: none;
    opacity: 0;
    animation: fadeInHint 0.2s ease 0.3s forwards;
    z-index: 2;
}

@keyframes fadeInHint {
    to { opacity: 1; }
}

.comment-edit-surface {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.comment-edit-input {
    min-height: 120px;
    background: var(--rz-base-background-color);
    border-color: var(--rz-primary-lighter);
}

.comment-edit-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* SIDEBAR */
.ticket-sidebar {
    /* Wider than the old 392 px so the Cliente / Proyecto / Asignado
       dropdowns have room for the selected value + caret + clear icon
       without the label text clipping or pushing sibling fields. */
    width: 440px;
    min-width: 360px;
    flex-shrink: 0;
    padding: 1rem 1rem 1.25rem;
    background: var(--rz-base-50);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 80vh;
}

.status-btn {
    width: 100%;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.status-dropdown {
    width: 100%;
}

.status-btn:hover {
    filter: brightness(0.9);
}

.status-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--rz-base-background-color);
    border: 1px solid var(--rz-base-300);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    margin-top: 0.25rem;
    overflow: hidden;
}

.status-option {
    width: 100%;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    transition: background 0.1s ease;
    border: none;
    background: transparent;
    color: inherit;
    text-align: left;
    font-family: inherit;
}

.status-option:hover {
    background: var(--rz-base-100);
}

.status-option.active {
    background: var(--rz-base-200);
    font-weight: 600;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.details-section {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: var(--rz-base-background-color);
    border-radius: 14px;
    border: 1px solid var(--rz-base-200);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.details-header {
    padding: 0.875rem 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rz-text-tertiary-color);
    border-bottom: 1px solid var(--rz-base-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.details-header:hover {
    background: var(--rz-base-50);
}

.details-body {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    padding: 0.25rem 0;
}

.detail-row {
    display: grid;
    grid-template-columns: minmax(104px, 116px) minmax(0, 1fr);
    align-items: start;
    padding: 0.8rem 1rem;
    gap: 0.875rem;
    transition: background 0.15s ease;
    min-height: 48px;
}

.detail-row:hover {
    background: var(--rz-base-50);
}

.detail-row-select {
    align-items: center;
}

.detail-label {
    width: auto;
    font-size: 0.6875rem;
    color: var(--rz-text-tertiary-color);
    line-height: 1.35;
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
}

.detail-value {
    font-size: 0.8125rem;
    color: var(--rz-text-color);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    min-width: 0;
    width: 100%;
    flex-wrap: wrap;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.detail-row-select .detail-value {
    align-items: center;
}

.detail-value.empty {
    color: var(--rz-text-tertiary-color);
    font-style: italic;
}

.detail-value.interactive {
    cursor: pointer;
}

.detail-person-name {
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    max-width: 100%;
    display: block;
}

.detail-row-alert {
    display: block;
    padding: 0 1rem 0.875rem calc(1rem + 116px + 0.875rem);
    min-height: 0;
}

.detail-inline-alert {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--rz-warning-lighter);
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--rz-warning-darker);
    line-height: 1.35;
}

.detail-row-time {
    align-items: center;
}

.detail-value-time {
    padding: 0;
    min-height: 48px;
}

.detail-value-time-list {
    display: block;
    width: 100%;
    padding-top: 0.125rem;
}

.detail-time-entries-block {
    display: block;
    padding: 0 1rem 0.875rem calc(1rem + 116px + 0.875rem);
    min-height: 0;
}

.assignee-avatar {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.detail-value span {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* NOTE: Sidebar dropdowns intentionally carry NO custom CSS. The old
   114-line block that forced `display:grid`, fixed heights, custom
   grid-template-columns, forced label typography and
   `!important` trigger positions was overriding Radzen's own layout
   and caused the selected value to drift outside the trigger on some
   locales / widths ("la letra se sale del desplegable"). Removing it
   restores Radzen's native geometry — trigger, label, clear icon and
   arrow all sized and spaced by the active theme. Width is the only
   thing we still drive, via `.detail-value { width: 100%; }` above. */

.priority-badge {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.priority-badge .material-icons {
    font-size: 14px;
}

/* WATCHERS */
.watcher-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
}

.watcher-item:hover {
    background: var(--rz-base-100);
}

.watcher-info {
    flex: 1;
    min-width: 0;
}

.watcher-name {
    font-size: 0.8125rem;
    color: var(--rz-text-color);
    display: block;
}

.watcher-email {
    font-size: 0.6875rem;
    color: var(--rz-text-tertiary-color);
    display: block;
}

.watcher-remove {
    background: transparent;
    border: none;
    color: var(--rz-text-tertiary-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.watcher-item:hover .watcher-remove {
    opacity: 1;
}

.watcher-remove:hover {
    background: var(--rz-danger-lighter);
    color: var(--rz-danger);
}

.add-watcher-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    color: var(--rz-primary);
    font-size: 0.75rem;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.add-watcher-btn:hover {
    background: var(--rz-base-100);
}

.add-watcher-form {
    display: flex;
    gap: 0.375rem;
    padding: 0.625rem 1rem 0.75rem;
    align-items: center;
}

/* Watcher picker (org members + agents). */
.watcher-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.75rem;
    border-top: 1px solid var(--rz-base-200);
    background: var(--rz-base-50);
}

.watcher-picker-search {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--rz-base-300);
    border-radius: 6px;
    background: var(--rz-base-background-color);
}

.watcher-picker-search .rzi { color: var(--rz-text-tertiary-color); }

.watcher-picker-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--rz-text-primary-color);
    font-size: 0.78rem;
}

.watcher-picker-close {
    background: transparent;
    border: none;
    color: var(--rz-text-tertiary-color);
    cursor: pointer;
    padding: 0.15rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
}

.watcher-picker-close:hover {
    background: var(--rz-base-100);
    color: var(--rz-text-primary-color);
}

.watcher-picker-list {
    display: flex;
    flex-direction: column;
    max-height: 280px;
    overflow-y: auto;
    border-radius: 6px;
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-base-200);
}

.watcher-picker-group {
    padding: 0.3rem 0.6rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--rz-text-tertiary-color);
    background: var(--rz-base-100);
    border-bottom: 1px solid var(--rz-base-200);
    position: sticky;
    top: 0;
    z-index: 1;
}

.watcher-picker-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.6rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--rz-base-100);
    text-align: left;
    cursor: pointer;
    width: 100%;
    color: var(--rz-text-primary-color);
}

.watcher-picker-row:last-child { border-bottom: none; }

.watcher-picker-row:hover {
    background: color-mix(in srgb, var(--rz-primary) 8%, transparent);
}

.watcher-picker-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.watcher-picker-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--rz-text-primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.watcher-picker-email {
    font-size: 0.68rem;
    color: var(--rz-text-tertiary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.watcher-picker-tag {
    flex-shrink: 0;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.08rem 0.45rem;
    border-radius: 999px;
}

.watcher-picker-tag-agent {
    color: var(--rz-primary);
    background: color-mix(in srgb, var(--rz-primary) 12%, transparent);
}

.watcher-picker-empty {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 0.5rem;
    color: var(--rz-text-tertiary-color);
    font-size: 0.73rem;
}

.sidebar-empty-note {
    padding: 0.5rem 1rem 0.75rem;
    color: var(--rz-text-tertiary-color);
    font-size: 0.75rem;
    line-height: 1.35;
}

/* ASSIGN BUTTON */
.assign-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--rz-info-lighter);
    border: 1px solid var(--rz-info-light);
    border-radius: 4px;
    color: var(--rz-info);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.assign-btn:hover {
    background: var(--rz-info-light);
    color: var(--rz-on-info-lighter);
}

.assign-change-btn {
    background: transparent;
    border: none;
    color: var(--rz-text-tertiary-color);
    cursor: pointer;
    padding: 0.125rem;
    border-radius: 4px;
    opacity: 0.7;
    transition: all 0.15s ease;
}

.assign-change-btn:hover {
    background: var(--rz-base-200);
    color: var(--rz-primary);
    opacity: 1;
}

/* EMOJI REACTIONS */
.td-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    align-items: center;
    position: relative;
}

.td-reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--rz-base-50);
    border: 1px solid var(--rz-base-200);
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--rz-text-secondary-color);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
    line-height: 1.4;
}

.td-reaction-chip:hover {
    background: var(--rz-base-100);
    border-color: var(--rz-base-300);
}

.td-reaction-chip--active {
    background: var(--rz-primary-lighter, #e7f0ff);
    border-color: var(--rz-primary, #4a86e8);
    color: var(--rz-primary, #4a86e8);
}

.td-reaction-chip--add {
    padding: 2px 6px;
}

.td-reaction-chip__emoji { font-size: 0.9rem; }
.td-reaction-chip__count { font-variant-numeric: tabular-nums; }

.td-reaction-picker {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    display: flex;
    gap: 2px;
    padding: 4px;
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-base-200);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 10;
}

.td-reaction-picker__item {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 1.1rem;
    cursor: pointer;
}

.td-reaction-picker__item:hover { background: var(--rz-base-100); }

/* RESPONSIVE */
@media (max-width: 900px) {
    .ticket-dialog {
        flex-direction: column;
        max-height: none;
    }

    .ticket-main {
        border-right: none;
        border-bottom: 1px solid var(--rz-base-200);
    }

    .ticket-sidebar {
        width: 100%;
        min-width: unset;
    }

    .detail-row-alert,
    .detail-time-entries-block {
        padding-left: 1rem;
    }
}

/* ATTACHMENTS */
.attachment-dropzone {
    border: 2px dashed var(--rz-base-300);
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    margin-bottom: 0.75rem;
}

.attachment-dropzone:hover {
    border-color: var(--rz-primary);
    background: var(--rz-primary-lighter);
}

.attachment-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.attachment-dropzone label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--rz-text-tertiary-color);
    cursor: pointer;
    pointer-events: none;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    background: var(--rz-base-100);
    transition: all 0.15s ease;
}

.attachment-item:hover {
    background: var(--rz-base-200);
}

.attachment-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--rz-base-200);
    flex-shrink: 0;
    cursor: pointer;
}

.attachment-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--rz-text-color);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-meta {
    font-size: 0.6875rem;
    color: var(--rz-text-tertiary-color);
}

.attachment-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.attachment-actions button,
.attachment-actions a {
    padding: 0.25rem;
    border-radius: 4px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--rz-text-tertiary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    text-decoration: none;
}

.attachment-actions button:hover,
.attachment-actions a:hover {
    background: var(--rz-base-300);
    color: var(--rz-text-color);
}

.attachment-actions .rzi {
    font-size: 1rem;
}

/* Preview modal */
.preview-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    filter: none;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.preview-modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    color: white;
    z-index: 1;
}

.preview-modal-header span {
    font-size: 0.875rem;
    font-weight: 500;
}

.preview-modal-header button,
.preview-modal-header a {
    padding: 0.5rem;
    border-radius: 4px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: background 0.15s;
}

.preview-modal-header button:hover,
.preview-modal-header a:hover {
    background: rgba(255,255,255,0.3);
}

.preview-modal-content {
    max-width: 90vw;
    max-height: 85vh;
}

.preview-modal-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Time Tracking: Sidebar widget */
.time-widget {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.125rem 0;
    width: 100%;
    min-height: 40px;
}

.time-widget-value {
    display: flex;
    position: static;
    min-width: 0;
    align-items: center;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--rz-text-color);
    letter-spacing: -0.02em;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-widget-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
}

.time-widget-label {
    display: none;
}

.time-widget-detail {
    font-size: 0.6875rem;
    color: var(--rz-text-secondary-color);
    margin-top: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.time-widget-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--rz-base-300);
    background: var(--rz-base-background-color);
    color: var(--rz-text-secondary-color);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: none;
    outline: none;
    appearance: none;
}

.time-widget-btn:hover {
    background: var(--rz-base-100);
    border-color: color-mix(in srgb, var(--rz-primary) 24%, var(--rz-base-300));
    color: var(--rz-primary);
    transform: translateY(-1px);
}

.time-widget-btn.primary {
    background: var(--rz-primary-lighter);
    border-color: color-mix(in srgb, var(--rz-primary) 22%, var(--rz-base-300));
    color: var(--rz-primary);
}

.time-widget-btn.primary:hover {
    background: var(--rz-primary);
    color: var(--rz-on-primary-lighter);
    opacity: 1;
    transform: translateY(-1px);
}

/* Time Tracking: Sidebar mini-entries */
.time-sidebar-entries {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0 0;
    border-top: 1px solid var(--rz-base-200);
    animation: fadeIn 0.2s ease;
}

.time-sidebar-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 6px;
    transition: background 0.15s ease;
    cursor: pointer;
}

.time-sidebar-entry:hover {
    background: var(--rz-base-200);
}

.time-sidebar-entry-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--rz-primary-lighter);
    color: var(--rz-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5625rem;
    font-weight: 600;
    flex-shrink: 0;
}

.time-sidebar-entry-body {
    flex: 1;
    min-width: 0;
    font-size: 0.6875rem;
    color: var(--rz-text-secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.time-sidebar-entry-hours {
    font-weight: 700;
    font-size: 0.6875rem;
    color: var(--rz-primary);
    flex-shrink: 0;
}

/* Time Tracking: Activity tab */
.time-tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0 0.75rem;
}

.time-tab-stat {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
}

.time-tab-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--rz-text-color);
    letter-spacing: -0.02em;
}

.time-tab-stat-unit {
    font-size: 0.75rem;
    color: var(--rz-text-tertiary-color);
    font-weight: 500;
}

.time-tab-entries {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.time-tab-entry {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.5rem;
    border-radius: 8px;
    transition: background 0.15s ease;
    position: relative;
    cursor: pointer;
}

.time-tab-entry:hover {
    background: var(--rz-base-100);
}

.time-tab-entry + .time-tab-entry {
    border-top: 1px solid var(--rz-base-200);
}

.time-tab-entry-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 600;
    flex-shrink: 0;
}

.time-tab-entry-content {
    flex: 1;
    min-width: 0;
}

.time-tab-entry-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.time-tab-entry-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--rz-text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.time-tab-entry-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--rz-primary);
    background: var(--rz-primary-lighter);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    flex-shrink: 0;
}

.time-tab-entry-meta {
    font-size: 0.6875rem;
    color: var(--rz-text-tertiary-color);
    margin-top: 0.125rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.time-tab-entry-meta .billable-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--rz-success);
    flex-shrink: 0;
}

.time-tab-entry-meta .billable-dot.non-billable {
    background: var(--rz-text-disabled-color);
}

.time-tab-entry-desc {
    font-size: 0.75rem;
    color: var(--rz-text-secondary-color);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.time-tab-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    text-align: center;
}

.time-tab-empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--rz-base-200);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rz-text-tertiary-color);
}

.time-tab-empty-text {
    font-size: 0.8125rem;
    color: var(--rz-text-tertiary-color);
}

.time-no-project {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    text-align: center;
}

.time-no-project-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--rz-warning-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rz-warning);
}
