/*
 * Ticket page (resources/views/filament/tickets). Only layout and the
 * pieces Filament has no component for (timeline, composer); colours come
 * from Filament's own variables so light and dark mode both work.
 */

.tk-layout {
    --tk-border: color-mix(in oklab, var(--gray-950) 10%, transparent);
    --tk-border-soft: color-mix(in oklab, var(--gray-950) 6%, transparent);
    --tk-surface: color-mix(in oklab, var(--gray-950) 2%, transparent);
    --tk-text: var(--gray-950);
    --tk-strong: var(--gray-950);
    --tk-muted: var(--gray-500);
    --tk-faint: var(--gray-400);

    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
    font-size: 0.875rem;
    line-height: 1.5rem;
    color: var(--tk-text);
}

.dark .tk-layout {
    --tk-border: rgb(255 255 255 / 0.1);
    --tk-border-soft: rgb(255 255 255 / 0.06);
    --tk-surface: rgb(255 255 255 / 0.03);
    --tk-text: var(--gray-200);
    --tk-strong: #fff;
    --tk-muted: var(--gray-400);
    --tk-faint: var(--gray-500);
}

@media (min-width: 1024px) {
    .tk-layout {
        grid-template-columns: minmax(0, 1fr) 17.75rem;
    }

    .tk-side {
        position: sticky;
        top: 6rem;
    }
}

.tk-main,
.tk-side {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.tk-muted {
    color: var(--tk-muted);
}

.tk-warning {
    color: var(--warning-600);
}

.dark .tk-warning {
    color: var(--warning-400);
}

.tk-dot {
    width: 3px;
    height: 3px;
    border-radius: 9999px;
    background: var(--tk-faint);
}

.tk-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--tk-text);
    background: var(--gray-100);
    box-shadow: inset 0 0 0 1px var(--tk-border);
}

.dark .tk-avatar {
    background: var(--gray-800);
}

.tk-avatar-lg {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}

/* Pinned description */

.tk-pinned-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    color: var(--tk-muted);
}

.tk-pinned-label-icon {
    width: 0.875rem;
    height: 0.875rem;
    color: var(--tk-faint);
}

.tk-pinned-title {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    line-height: 1.75rem;
    font-weight: 600;
    color: var(--tk-strong);
}

.tk-pinned-meta .fi-badge {
    flex: none;
}

.tk-pinned-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    color: var(--tk-muted);
}

.tk-pinned-body,
.tk-bubble {
    border-radius: 0.5rem;
    background: var(--tk-surface);
    box-shadow: inset 0 0 0 1px var(--tk-border-soft);
}

/* The description is the whole card: no second box inside it. */
.tk-pinned .tk-pinned-body {
    padding: 0;
    background: none;
    box-shadow: none;
}

/* Status, Urgent and the like, under the ticket's name. */
.tk-header-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.tk-header-badges .fi-badge {
    flex: none;
    max-width: none;
}

.tk-header-badges .fi-badge .fi-badge-label-ctn,
.tk-header-badges .fi-badge .fi-badge-label {
    overflow: visible;
    text-overflow: clip;
}

/* The composer's place while nobody has claimed the ticket. */
.tk-feed-locked {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    border-radius: 0.5rem;
    box-shadow: inset 0 0 0 1px var(--tk-border-soft, rgb(0 0 0 / 0.06));
}

.tk-feed-locked-icon {
    width: 1rem;
    height: 1rem;
    flex: none;
}

.tk-pinned-body p,
.tk-bubble p {
    margin: 0;
}

.tk-pinned-person {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    line-height: 1rem;
    color: var(--tk-muted);
}

.tk-pinned-person strong {
    font-weight: 500;
    color: var(--tk-text);
}

/* Activity: the header row is Filament's; the filters sit under its title,
   then composer and list run edge to edge inside the section. */

.tk-activity > .fi-section-header {
    padding-bottom: 0;
    border-bottom: 0;
}

.tk-activity > .fi-section-content-ctn {
    border-top: 0;
}

.tk-activity > .fi-section-content-ctn > .fi-section-content {
    padding: 0;
}

.tk-filters.fi-tabs {
    padding-inline: 1rem;
}

.tk-filters .fi-tabs-item {
    padding-inline: 0.5rem;
}

.tk-composer {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--tk-border);
}

.tk-composer-box {
    border-radius: 0.5rem;
    box-shadow: 0 0 0 1px var(--tk-border), 0 1px 2px rgb(0 0 0 / 0.05);
}

.tk-composer-tabs.fi-tabs {
    padding: 0.375rem;
}

.tk-composer-to {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.375rem 0.375rem 0.75rem;
    border-bottom: 1px solid var(--tk-border-soft);
}

.tk-composer-label {
    margin-right: 0.125rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--tk-faint);
}

.tk-composer-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--tk-border-soft);
}

.tk-composer-input {
    display: block;
    width: 100%;
    min-height: 4rem;
    padding: 0.625rem 0.75rem;
    border: 0;
    resize: none;
    field-sizing: content;
    background: transparent;
    font: inherit;
    color: var(--tk-text);
    outline: none;
}

.tk-composer-input::placeholder {
    color: var(--tk-faint);
}

.tk-composer-empty {
    padding: 1rem 0.75rem;
    color: var(--tk-muted);
}

.tk-composer-files {
    padding: 0 0.75rem 0.5rem;
}

.tk-composer-error {
    padding: 0 0.75rem 0.5rem;
    font-size: 0.75rem;
    color: var(--danger-600);
}

.dark .tk-composer-error {
    color: var(--danger-400);
}

.tk-composer-foot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.375rem 0.375rem 0.75rem;
    border-top: 1px solid var(--tk-border-soft);
}

.tk-composer-attach {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 0.25rem;
    height: 1.75rem;
    padding: 0 0.5rem 0 0.375rem;
    margin-left: -0.375rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--tk-muted);
}

.tk-composer-attach:hover {
    background: var(--tk-surface);
}

.tk-composer-attach:hover {
    color: var(--tk-muted);
}

.tk-composer-attach-icon {
    width: 1rem;
    height: 1rem;
}

.tk-composer-hint {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 0.75rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--tk-faint);
}

.tk-seg-icon {
    width: 0.875rem;
    height: 0.875rem;
    color: var(--tk-faint);
}



/* Under the text: the email tickbox (Requester) or the people (Someone else). */
.tk-composer-extra {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem 0.5rem;
}

/* "Visible to" sits with the send button it applies to. */
.tk-visibility-btn {
    display: inline-flex;
    white-space: nowrap;
    align-items: center;
    gap: 0.375rem;
    height: 2rem;
    padding: 0 0.5rem 0 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--tk-text);
    box-shadow: inset 0 0 0 1px var(--tk-border);
}

.tk-visibility-btn:hover {
    background: var(--tk-surface);
}

.tk-visibility-prefix {
    color: var(--tk-faint);
}

.tk-composer-check {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--tk-text);
    cursor: pointer;
}

.tk-composer-actions {
    display: flex;
    white-space: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

/* People chips */

.tk-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 1.5rem;
    padding: 0 0.25rem 0 0.1875rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--tk-text);
    background: var(--tk-surface);
    box-shadow: inset 0 0 0 1px var(--tk-border);
}

.tk-chip-avatar {
    width: 1.125rem;
    height: 1.125rem;
}

.tk-chip-remove {
    display: inline-flex;
    color: var(--tk-faint);
}

.tk-chip-remove:hover {
    color: var(--tk-text);
}

.tk-chip-remove-icon,
.tk-add-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.tk-add {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--tk-faint);
}

.tk-add:hover {
    color: var(--tk-text);
}

.tk-picker-search {
    padding: 0.5rem;
}

/* Timeline */

.tk-timeline {
    margin: 0;
    padding: 1.5rem 1.5rem 0.5rem;
    list-style: none;
}

.fi-modal .tk-timeline {
    padding: 1.5rem 0 0;
}

.tk-timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 1rem;
    padding-bottom: 1.5rem;
}

.tk-timeline-item::before {
    content: '';
    position: absolute;
    top: 2.25rem;
    bottom: 0.25rem;
    left: calc(1rem - 0.5px);
    width: 1px;
    background: var(--tk-border);
}

.tk-timeline-item:last-child::before {
    display: none;
}

.tk-timeline-node {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    color: var(--tk-muted);
    box-shadow: inset 0 0 0 1px var(--tk-border);
}

.tk-timeline-node-icon {
    width: 1rem;
    height: 1rem;
}

.tk-tone-info {
    color: var(--info-700);
    background: color-mix(in oklab, var(--info-400) 10%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--info-400) 30%, transparent);
}

.tk-tone-danger {
    color: var(--danger-700);
    background: color-mix(in oklab, var(--danger-400) 10%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--danger-400) 30%, transparent);
}

.tk-tone-success {
    color: var(--success-700);
    background: color-mix(in oklab, var(--success-400) 10%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--success-400) 30%, transparent);
}

.tk-tone-primary {
    color: var(--primary-700);
    background: color-mix(in oklab, var(--primary-400) 18%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--primary-400) 55%, transparent);
}

/* Stages: their own colour, so they stand apart from everything else. */
.tk-tone-stage {
    color: var(--info-700);
    background: color-mix(in oklab, var(--info-400) 14%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--info-400) 45%, transparent);
    border-radius: 0.5rem;
}

.tk-tone-warning,
.tk-tone-pending {
    color: var(--warning-600);
    background: color-mix(in oklab, var(--warning-400) 10%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--warning-400) 40%, transparent);
}

.tk-tone-pending {
    background: transparent;
}

.dark .tk-tone-primary {
    color: var(--primary-300);
}

.dark .tk-tone-stage {
    color: var(--info-300);
}

.dark .tk-tone-info {
    color: var(--info-200);
}

.dark .tk-tone-danger {
    color: var(--danger-200);
}

.dark .tk-tone-success {
    color: var(--success-200);
}

.dark .tk-tone-warning,
.dark .tk-tone-pending {
    color: var(--warning-400);
}

.tk-timeline-content {
    min-width: 0;
}

.tk-timeline-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    min-height: 2rem;
    padding-top: 0.25rem;
}

.tk-timeline-text strong {
    font-weight: 600;
    color: var(--tk-strong);
}

.tk-timeline-aside {
    margin-left: auto;
}

.tk-timeline-time {
    flex: none;
    font-size: 0.75rem;
    line-height: 1rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--tk-muted);
}

.tk-timeline-byline {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1rem;
    color: var(--tk-muted);
}

.tk-timeline-sub {
    margin: 0.125rem 0 0;
    line-height: 1.25rem;
    color: var(--tk-muted);
}

.tk-bubble {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
}

.tk-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tk-bubble .tk-files,
.tk-timeline-content > .tk-files {
    margin-top: 0.75rem;
}

button.tk-file {
    cursor: pointer;
}

button.tk-file:hover {
    background: var(--tk-surface);
    box-shadow: inset 0 0 0 1px var(--tk-faint);
}

.tk-file {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 2rem;
    padding: 0 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--tk-text);
    box-shadow: inset 0 0 0 1px var(--tk-border);
}

.tk-file-icon {
    width: 1rem;
    height: 1rem;
    color: var(--tk-faint);
}

/* Details and durations */

.tk-side-card > .fi-section-content-ctn > .fi-section-content {
    padding: 0.5rem 1.5rem 1rem;
}

.tk-side-list {
    margin: 0;
}

.tk-side-list > div {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--tk-border-soft);
}

.tk-side-list > div:last-child {
    border-bottom: 0;
}

.tk-side-list dt {
    color: var(--tk-muted);
}

.tk-side-list dd {
    margin: 0;
    text-align: right;
}

.tk-side-list-stacked > div {
    flex-direction: column;
    gap: 0;
}

.tk-side-list-stacked dd {
    text-align: left;
}

.tk-side-note {
    display: block;
    font-size: 0.75rem;
    line-height: 1rem;
    color: var(--tk-muted);
}

/* Focus: the Activity card fills the screen, above the topbar and sidebar. */

.tk-activity.tk-activity-focused {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    overflow: hidden;
}

.tk-activity.tk-activity-focused > .fi-section-content-ctn {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.tk-activity.tk-activity-focused > .fi-section-header,
.tk-activity.tk-activity-focused > .fi-section-content-ctn > .fi-section-content {
    width: 100%;
    max-width: 64rem;
    margin-inline: auto;
}

html.tk-focus-open {
    overflow: hidden;
}

/* New entries (e.g. right after claiming) slide down into the feed. */

.tk-timeline-item-new {
    animation: tk-drop-in 450ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.tk-timeline-item-new > .tk-timeline-node {
    animation: tk-glow 1.6s ease-out 1;
}

@keyframes tk-drop-in {
    from {
        opacity: 0;
        transform: translateY(-1.25rem);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes tk-glow {
    from {
        box-shadow: 0 0 0 0.375rem color-mix(in oklab, var(--primary-400) 45%, transparent);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tk-timeline-item-new,
    .tk-timeline-item-new > .tk-timeline-node {
        animation: none;
    }
}

/* Due date with a live countdown. */

.tk-due {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.375rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    line-height: 1.25rem;
    color: var(--tk-text);
    background: var(--tk-surface);
    box-shadow: inset 0 0 0 1px var(--tk-border);
}

.tk-due-icon {
    width: 0.875rem;
    height: 0.875rem;
    color: var(--tk-faint);
}

.tk-countdown {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--info-600);
}

.dark .tk-countdown {
    color: var(--info-300);
}

.tk-countdown-overdue {
    color: var(--danger-600);
}

.dark .tk-countdown-overdue {
    color: var(--danger-400);
}

.tk-stage-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tk-composer-template {
    flex: 1;
    min-width: 0;
}

.tk-timeline-empty {
    padding-bottom: 1rem;
    color: var(--tk-muted);
}

/* Stages assigned to the viewer. */
.tk-mine > .tk-timeline-content {
    margin-left: -0.5rem;
    padding: 0 0.5rem 0.5rem;
    border-radius: 0.5rem;
    background: color-mix(in oklab, var(--primary-400) 8%, transparent);
    box-shadow: inset 2px 0 0 var(--primary-400);
}

.tk-mine > .tk-timeline-node {
    box-shadow: inset 0 0 0 2px var(--primary-400);
}

/* Activity entries: text, then buttons, then who/what/when (small). */

.tk-timeline-headline {
    padding-top: 0.25rem;
    font-weight: 600;
    color: var(--tk-strong);
    overflow-wrap: anywhere;
}

.tk-timeline-headline-text {
    font-weight: 400;
    color: var(--tk-text);
}

.tk-timeline-content > .tk-files,
.tk-timeline-content > .tk-due,
.tk-timeline-content > .tk-stage-actions {
    margin-top: 0.5rem;
}

.tk-timeline-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin: 0.375rem 0 0;
    font-size: 0.75rem;
    line-height: 1rem;
    color: var(--tk-muted);
}

.tk-timeline-meta time {
    font-variant-numeric: tabular-nums;
}

.tk-timeline-meta-icon {
    width: 0.75rem;
    height: 0.75rem;
}

/* The stage a reminder points to flashes once when the ticket opens. */
.tk-stage-target > .tk-timeline-content {
    animation: tk-target 2.4s ease-out 1;
    border-radius: 0.5rem;
}

@keyframes tk-target {
    0%,
    40% {
        background: color-mix(in oklab, var(--primary-400) 22%, transparent);
        box-shadow: 0 0 0 0.375rem color-mix(in oklab, var(--primary-400) 22%, transparent);
    }
}

/* Stages filter: progress summary, then the stages on a rail. */

.tk-stages-summary {
    padding: 1.25rem 1.25rem 1.125rem;
    border-bottom: 1px solid var(--tk-border);
}

.tk-stages-summary-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.tk-stages-title {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--tk-strong);
}

.tk-stages-count {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    color: var(--tk-muted);
}

.tk-stages-count strong {
    font-weight: 600;
    color: var(--tk-strong);
}

.tk-stages-bar {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    gap: 0.25rem;
    margin-top: 0.625rem;
}

.tk-stages-segment {
    height: 0.375rem;
    border-radius: 9999px;
    background: var(--tk-border);
}

.tk-stages-segment-done {
    background: var(--success-500);
}

.tk-stages-segment-active {
    background: linear-gradient(90deg, var(--info-400) var(--tk-progress), color-mix(in oklab, var(--info-400) 25%, transparent) var(--tk-progress));
}

.tk-stages-list {
    margin: 0;
    padding: 1.125rem 1.25rem 1.25rem;
    list-style: none;
}

.tk-stages-empty {
    padding: 1.25rem;
    color: var(--tk-muted);
}

.tk-stage {
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr);
    column-gap: 0.875rem;
}

.tk-stage-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tk-stage-marker {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--tk-muted);
    box-shadow: inset 0 0 0 1px var(--tk-border);
}

.tk-stage-marker-icon {
    width: 1rem;
    height: 1rem;
}

.tk-stage-done .tk-stage-marker {
    color: var(--success-700);
    background: color-mix(in oklab, var(--success-400) 10%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--success-400) 30%, transparent);
}

.tk-stage-active .tk-stage-marker {
    color: var(--info-700);
    background: color-mix(in oklab, var(--info-400) 10%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--info-400) 30%, transparent);
}

.dark .tk-stage-done .tk-stage-marker {
    color: var(--success-200);
}

.dark .tk-stage-active .tk-stage-marker {
    color: var(--info-200);
}

.tk-stage-mine .tk-stage-marker {
    color: var(--primary-600);
    box-shadow: inset 0 0 0 1.5px var(--primary-400);
}

.dark .tk-stage-mine .tk-stage-marker {
    color: var(--primary-400);
}

.tk-stage-line {
    flex: 1;
    width: 0;
    min-height: 0.625rem;
    margin: 0.25rem 0;
    border-left: 1px dashed var(--tk-border);
}

.tk-stage-done .tk-stage-line {
    border-left: 2px solid color-mix(in oklab, var(--success-500) 50%, transparent);
}

.tk-stage:last-child .tk-stage-line {
    display: none;
}

.tk-stage-body {
    min-width: 0;
    padding: 0.1875rem 0 1.125rem;
}

.tk-stage:last-child .tk-stage-body {
    padding-bottom: 0;
}

.tk-stage-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.375rem;
}

.tk-stage-name {
    font-weight: 600;
    line-height: 1.25rem;
    color: var(--tk-strong);
}

.tk-stage-done .tk-stage-name {
    font-weight: 500;
    color: var(--tk-muted);
}

.tk-stage-status {
    margin-left: auto;
}

.tk-stage-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.625rem;
    margin: 0.1875rem 0 0;
    font-size: 0.75rem;
    line-height: 1rem;
    color: var(--tk-muted);
}

.tk-stage-meta-dot {
    width: 3px;
    height: 3px;
    border-radius: 9999px;
    background: var(--tk-faint);
}

.tk-stage-body > .tk-stage-actions {
    margin-top: 0.5rem;
}

.tk-stage-target > .tk-stage-body {
    animation: tk-target 2.4s ease-out 1;
    border-radius: 0.5rem;
}

.tk-stage-meta .tk-countdown {
    font-weight: 400;
}

/* Only the stage in progress counts down in colour. */
.tk-stage-pending .tk-countdown:not(.tk-countdown-overdue) {
    color: inherit;
}

/* Approvals tied to a stage: on the stage's card, and named in the feed. */
.tk-approval-stage {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.tk-stage-approval {
    margin-top: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--warning-500) 35%, transparent);
}

.tk-stage-approval .tk-stage-actions {
    margin-top: 0.5rem;
}

.tk-stage-approval-text {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    margin: 0;
    font-size: 0.875rem;
}

.tk-stage-approval-icon {
    width: 1rem;
    height: 1rem;
    flex: none;
    margin-top: 0.125rem;
    color: var(--warning-500);
}

.tk-composer-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Ticket page: Take over / More stay top right however long the title is;
   the title wraps beside them instead of pushing them down. */
@media (min-width: 640px) {
    .fi-resource-view-record-page.fi-resource-tickets .fi-header {
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    .fi-resource-view-record-page.fi-resource-tickets .fi-header > div:first-child:not(.fi-header-actions-ctn) {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }

    .fi-resource-view-record-page.fi-resource-tickets .fi-header .fi-header-actions-ctn {
        align-self: flex-start;
        /* Line up with the title, below the breadcrumbs. */
        margin-top: 1.75rem;
    }

    .fi-resource-view-record-page.fi-resource-tickets .fi-header-heading {
        overflow-wrap: anywhere;
    }
}

/* A stage's pauses, under its card. */
.tk-stage-pauses {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.tk-stage-pauses summary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
}

.tk-stage-pauses-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.tk-stage-pauses ol {
    margin: 0.375rem 0 0;
    padding-left: 1.25rem;
    list-style: disc;
}

.tk-stage-pauses-length {
    font-variant-numeric: tabular-nums;
    color: var(--gray-400);
}

/* The big Completed / Unarchive button under the Activity card. */
.tk-complete-btn.fi-btn {
    width: 100%;
    margin-top: 1rem;
    justify-content: center;
}

/* Focus: Completed stays at the bottom of the screen while the feed scrolls. */
.tk-focus-complete {
    position: sticky;
    bottom: 0;
    z-index: 1;
    padding: 0.75rem 0 1rem;
    background: linear-gradient(to bottom, transparent, white 1rem);
}

.dark .tk-focus-complete {
    background: linear-gradient(to bottom, transparent, var(--gray-900) 1rem);
}

.tk-focus-complete .tk-complete-btn.fi-btn {
    margin-top: 0;
}

/* Groups in the people pickers. */
.tk-chip-group-icon {
    width: 1rem;
    height: 1rem;
    color: var(--gray-500);
}

.tk-picker-count {
    margin-left: 0.25rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}
