From 18c90acda54cb46815a081ecfc36ea8f2b9e93fd Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Mon, 29 Jun 2026 00:12:04 +0800
Subject: [PATCH] Fix custom hotkey settings UI for 8.2.1

---
 src/Apptag/PreferencesView.swift |  467 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 414 insertions(+), 53 deletions(-)

diff --git a/src/Apptag/PreferencesView.swift b/src/Apptag/PreferencesView.swift
index 52b09ab..8838d3d 100644
--- a/src/Apptag/PreferencesView.swift
+++ b/src/Apptag/PreferencesView.swift
@@ -1,7 +1,10 @@
 import SwiftUI
 import AppKit
+import Carbon
 
 // MARK: - Preferences View
+
+private let themePreviewCountdownTimer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
 
 private enum SettingsTab: String, CaseIterable, Identifiable {
     case language
@@ -67,6 +70,8 @@
     @AppStorage("showUncommonAppBubbles") private var showUncommonAppBubbles = AppDefaults.showUncommonAppBubbles
     @AppStorage("hideUsageTips") private var hideUsageTips = AppDefaults.hideUsageTips
     @AppStorage(AppGridTheme.storageKey) private var appGridThemeID = AppDefaults.appGridThemeID
+    @AppStorage(AppGridTheme.deepBlueTuningStorageKey) private var deepBlueThemeTuning = AppGridTheme.deepBlue.defaultColorTuning
+    @AppStorage(AppGridTheme.colorfulTuningStorageKey) private var colorfulThemeTuning = AppGridTheme.colorful.defaultColorTuning
     @AppStorage("mainHotkeyRegistrationState") private var mainHotkeyRegistrationState = LauncherHotkeyRegistrationState.active.rawValue
     @AppStorage("quickSearchHotkeyRegistrationState") private var quickSearchHotkeyRegistrationState = LauncherHotkeyRegistrationState.active.rawValue
     @ObservedObject private var proEntitlement = ProEntitlementCenter.shared
@@ -82,9 +87,13 @@
     @State private var isDataFilePanelPresented = false
     @State private var hotkeyStatusToast: String? = nil
     @State private var hotkeyStatusToastToken: UUID? = nil
+    @State private var recordingHotkeyKind: LauncherHotkeyKind? = nil
+    @State private var hotkeyRecorderMonitor: Any? = nil
+    @State private var hotkeySettingsRefreshToken = UUID()
     @State private var selectedTab: SettingsTab = .general
     @State private var selectedInitialLayoutMode: InitialLayoutMode = .smart
     @State private var settingsProPromptFeature: ProFeature? = nil
+    @State private var themePreviewNow = Date()
 
     init(initialTabRawValue: String? = nil) {
         let initialTab = initialTabRawValue.flatMap(SettingsTab.init(rawValue:)) ?? .general
@@ -300,8 +309,78 @@
         let status = LauncherHotkeyRegistrationStore.failureCode(for: kind)
             .map(String.init) ?? "-"
         return tr(key)
-            .replacingOccurrences(of: "%shortcut%", with: kind.hotkey.displayString)
+            .replacingOccurrences(of: "%shortcut%", with: LauncherHotkeySettings.effectiveHotkey(for: kind).displayString)
             .replacingOccurrences(of: "%status%", with: status)
+    }
+
+    private func startHotkeyRecording(for kind: LauncherHotkeyKind) {
+        guard ProEntitlementPolicy.isUnlocked(.customHotkeys) else {
+            presentSettingsProPrompt(for: .customHotkeys)
+            return
+        }
+        stopHotkeyRecording(showCancelledToast: false)
+        recordingHotkeyKind = kind
+        showHotkeyStatusToast(tr("hotkeys.recording"))
+        hotkeyRecorderMonitor = NSEvent.addLocalMonitorForEvents(matching: .keyDown) { event in
+            DispatchQueue.main.async {
+                self.captureHotkeyEvent(event)
+            }
+            return nil
+        }
+    }
+
+    private func captureHotkeyEvent(_ event: NSEvent) {
+        guard let kind = recordingHotkeyKind else { return }
+        if Int(event.keyCode) == kVK_Escape {
+            stopHotkeyRecording(showCancelledToast: true)
+            return
+        }
+        let candidate = LauncherHotkeySettings.candidate(from: event)
+        let result = (NSApp.delegate as? AppDelegate)?
+            .applyCustomHotkey(candidate, for: kind)
+            ?? .registrationFailed(-1)
+        stopHotkeyRecording(showCancelledToast: false)
+        handleHotkeyCustomizationResult(result)
+    }
+
+    private func restoreDefaultHotkey(for kind: LauncherHotkeyKind) {
+        guard ProEntitlementPolicy.isUnlocked(.customHotkeys) else {
+            presentSettingsProPrompt(for: .customHotkeys)
+            return
+        }
+        let result = (NSApp.delegate as? AppDelegate)?
+            .restoreDefaultHotkey(for: kind)
+            ?? .registrationFailed(-1)
+        handleHotkeyCustomizationResult(result)
+    }
+
+    private func stopHotkeyRecording(showCancelledToast: Bool = false) {
+        if let hotkeyRecorderMonitor {
+            NSEvent.removeMonitor(hotkeyRecorderMonitor)
+        }
+        hotkeyRecorderMonitor = nil
+        recordingHotkeyKind = nil
+        if showCancelledToast {
+            showHotkeyStatusToast(tr("hotkeys.recordingCancelled"))
+        }
+    }
+
+    private func handleHotkeyCustomizationResult(_ result: LauncherHotkeyCustomizationResult) {
+        if case .locked = result {
+            presentSettingsProPrompt(for: .customHotkeys)
+            return
+        }
+        hotkeySettingsRefreshToken = UUID()
+        showHotkeyStatusToast(hotkeyCustomizationMessage(for: result))
+    }
+
+    private func hotkeyCustomizationMessage(for result: LauncherHotkeyCustomizationResult) -> String {
+        switch result {
+        case .registrationFailed(let status):
+            return tr(result.messageKey).replacingOccurrences(of: "%status%", with: String(status))
+        default:
+            return tr(result.messageKey)
+        }
     }
 
     private func showHotkeyStatusToast(_ message: String) {
@@ -610,6 +689,10 @@
 
     private var themeStatusSummary: String {
         if proEntitlement.isPreviewingTheme {
+            if let countdown = themePreviewCountdownText {
+                return tr("pro.theme.status.previewCountdown")
+                    .replacingOccurrences(of: "%time%", with: countdown)
+            }
             return tr("pro.theme.status.preview")
         }
         switch proEntitlement.accessState {
@@ -630,12 +713,64 @@
             appGridThemeID = theme.rawValue
             return
         }
-        proEntitlement.startThemePreview(for: theme)
+        proEntitlement.startThemePreview(for: theme, tuning: currentThemeTuning(for: theme))
+    }
+
+    private var activeColorTuningTheme: AppGridTheme? {
+        let theme = effectiveAppGridTheme
+        return theme.supportsColorTuning ? theme : nil
+    }
+
+    private func currentThemeTuning(for theme: AppGridTheme) -> Double {
+        if let preview = proEntitlement.themePreviewState,
+           preview.theme == theme {
+            return theme.normalizedTuning(preview.themeTuning)
+        }
+        switch theme {
+        case .deepBlue:
+            return theme.normalizedTuning(deepBlueThemeTuning)
+        case .colorful:
+            return theme.normalizedTuning(colorfulThemeTuning)
+        case .defaultLight, .black, .pink, .purple, .green, .blue:
+            return theme.defaultColorTuning
+        }
+    }
+
+    private func persistThemeTuning(_ tuning: Double?, for theme: AppGridTheme) {
+        let normalized = theme.normalizedTuning(tuning)
+        switch theme {
+        case .deepBlue:
+            deepBlueThemeTuning = normalized
+        case .colorful:
+            colorfulThemeTuning = normalized
+        case .defaultLight, .black, .pink, .purple, .green, .blue:
+            break
+        }
+    }
+
+    private func updateThemeTuning(_ value: Double, for theme: AppGridTheme) {
+        let normalized = theme.normalizedTuning(value)
+        if proEntitlement.isUnlocked || theme.isFreeTheme {
+            persistThemeTuning(normalized, for: theme)
+            return
+        }
+        if proEntitlement.themePreviewState?.theme == theme {
+            proEntitlement.updateThemePreviewTuning(normalized, for: theme)
+        } else {
+            proEntitlement.startThemePreview(for: theme, tuning: normalized)
+        }
+    }
+
+    private func themeTuningBinding(for theme: AppGridTheme) -> Binding<Double> {
+        Binding(
+            get: { currentThemeTuning(for: theme) },
+            set: { updateThemeTuning($0, for: theme) }
+        )
     }
 
     private func themeOptionAccessory(for theme: AppGridTheme) -> ThemeOptionAccessory {
         if let preview = proEntitlement.themePreviewState?.theme, preview == theme {
-            return .pill(text: tr("pro.card.previewBadge"), style: .preview)
+            return .countdown(text: themePreviewCountdownText ?? "00:00")
         }
         if !proEntitlement.isUnlocked && theme.requiresPro {
             return .pill(text: tr("pro.card.badge"), style: .locked)
@@ -650,6 +785,24 @@
         }
     }
 
+    private var themePreviewCountdownText: String? {
+        guard let preview = proEntitlement.themePreviewState else { return nil }
+        return Self.formatThemePreviewCountdown(seconds: preview.remainingSeconds(at: themePreviewNow))
+    }
+
+    private static func formatThemePreviewCountdown(seconds: Int) -> String {
+        let clamped = max(0, seconds)
+        return String(format: "%02d:%02d", clamped / 60, clamped % 60)
+    }
+
+    private func refreshThemePreviewCountdown(now: Date = Date()) {
+        themePreviewNow = now
+        guard let preview = proEntitlement.themePreviewState else { return }
+        if preview.remainingSeconds(at: now) <= 0 {
+            proEntitlement.stopThemePreview()
+        }
+    }
+
     private func dismissSettingsProPrompt() {
         proEntitlement.clearTransientOperationState()
         withAnimation(.easeOut(duration: 0.18)) {
@@ -661,10 +814,53 @@
         guard newState.isUnlocked else { return }
         if let preview = proEntitlement.themePreviewState {
             appGridThemeID = preview.theme.rawValue
+            persistThemeTuning(preview.themeTuning, for: preview.theme)
             proEntitlement.stopThemePreview()
         }
         if settingsProPromptFeature != nil {
             dismissSettingsProPrompt()
+        }
+    }
+
+    @ViewBuilder
+    private var themeColorTuningSection: some View {
+        if let theme = activeColorTuningTheme {
+            VStack(alignment: .leading, spacing: 8) {
+                HStack(alignment: .firstTextBaseline, spacing: 10) {
+                    Label(
+                        tr(theme == .deepBlue ? "theme.tuning.dark" : "theme.tuning.light"),
+                        systemImage: "slider.horizontal.3"
+                    )
+                    .font(.system(size: 13, weight: .semibold))
+                    .foregroundStyle(.primary)
+
+                    Spacer(minLength: 12)
+
+                    Text("\(Int(round(currentThemeTuning(for: theme) * 100)))")
+                        .font(.system(size: 12, weight: .semibold, design: .monospaced))
+                        .foregroundStyle(.secondary)
+                }
+
+                Slider(value: themeTuningBinding(for: theme), in: 0...1)
+                    .controlSize(.regular)
+                    .accessibilityLabel(tr(theme == .deepBlue ? "theme.tuning.dark" : "theme.tuning.light"))
+
+                Text(tr("theme.tuning.desc"))
+                    .font(.caption)
+                    .foregroundStyle(.secondary)
+                    .fixedSize(horizontal: false, vertical: true)
+            }
+            .padding(14)
+            .frame(maxWidth: .infinity, alignment: .leading)
+            .background(
+                RoundedRectangle(cornerRadius: 10, style: .continuous)
+                    .fill(Color(nsColor: .controlBackgroundColor).opacity(0.82))
+            )
+            .overlay(
+                RoundedRectangle(cornerRadius: 10, style: .continuous)
+                    .stroke(Color.secondary.opacity(0.18), lineWidth: 1)
+            )
+            .transition(.opacity.combined(with: .move(edge: .top)))
         }
     }
 
@@ -739,12 +935,19 @@
                 .font(.system(size: 13, weight: .semibold))
                 .foregroundStyle(.secondary)
 
-            StaticHotkeyInfoRow(
+            CustomizableHotkeyInfoRow(
                 title: tr("quickSearch.mainHotkey"),
                 description: tr("quickSearch.mainHotkeyDesc"),
-                displayText: LauncherHotkey.main.displayString,
+                displayText: LauncherHotkeySettings.effectiveHotkey(for: .main).displayString,
                 statusText: hotkeyStatusText(for: .main),
-                statusTone: hotkeyStatusTone(for: .main)
+                statusTone: hotkeyStatusTone(for: .main),
+                customizeTitle: proEntitlement.isUnlocked ? tr("hotkeys.customize") : tr("pro.card.badge"),
+                restoreTitle: tr("hotkeys.restoreDefault"),
+                isRecording: recordingHotkeyKind == .main,
+                isProLocked: !proEntitlement.isUnlocked,
+                canRestore: proEntitlement.isUnlocked && LauncherHotkeySettings.hasCustomHotkey(for: .main),
+                onCustomize: { startHotkeyRecording(for: .main) },
+                onRestore: { restoreDefaultHotkey(for: .main) }
             )
 
             StaticHotkeyInfoRow(
@@ -755,14 +958,30 @@
                 statusTone: .neutral
             )
 
-            StaticHotkeyInfoRow(
+            CustomizableHotkeyInfoRow(
                 title: tr("quickSearch.globalHotkey"),
                 description: tr("quickSearch.globalHotkeyDesc"),
-                displayText: LauncherHotkey.quickSearch.displayString,
+                displayText: LauncherHotkeySettings.effectiveHotkey(for: .quickSearch).displayString,
                 statusText: hotkeyStatusText(for: .quickSearch),
-                statusTone: hotkeyStatusTone(for: .quickSearch)
+                statusTone: hotkeyStatusTone(for: .quickSearch),
+                customizeTitle: proEntitlement.isUnlocked ? tr("hotkeys.customize") : tr("pro.card.badge"),
+                restoreTitle: tr("hotkeys.restoreDefault"),
+                isRecording: recordingHotkeyKind == .quickSearch,
+                isProLocked: !proEntitlement.isUnlocked,
+                canRestore: proEntitlement.isUnlocked && LauncherHotkeySettings.hasCustomHotkey(for: .quickSearch),
+                onCustomize: { startHotkeyRecording(for: .quickSearch) },
+                onRestore: { restoreDefaultHotkey(for: .quickSearch) }
+            )
+
+            StaticHotkeyInfoRow(
+                title: tr("trackpadGesture.title"),
+                description: tr("trackpadGesture.description"),
+                displayText: "taglauncher://show",
+                statusText: tr("trackpadGesture.status"),
+                statusTone: .neutral
             )
         }
+        .id(hotkeySettingsRefreshToken)
     }
 
     private var themeProStatusRow: some View {
@@ -821,11 +1040,6 @@
                     .lineSpacing(2)
                     .fixedSize(horizontal: false, vertical: true)
 
-                if let price = proEntitlement.priceDisplayText, !proEntitlement.isUnlocked {
-                    Text(price)
-                        .font(.system(size: 12, weight: .semibold))
-                        .foregroundStyle(Color.accentColor)
-                }
             }
 
             Spacer(minLength: 16)
@@ -1077,22 +1291,15 @@
                     case .theme:
             ScrollView(.vertical, showsIndicators: true) {
                 VStack(alignment: .leading, spacing: 18) {
-                    VStack(alignment: .leading, spacing: 6) {
-                        Text(tr("settings.theme"))
-                            .font(.headline)
-                        Text(tr("settings.themeDesc"))
-                            .font(.caption)
-                            .foregroundStyle(.secondary)
-                    }
-
                     themeProStatusRow
 
                     LazyVGrid(columns: themeColumns, alignment: .leading, spacing: 12) {
-                        ForEach(AppGridTheme.allCases) { theme in
+                        ForEach(AppGridTheme.settingsDisplayOrder) { theme in
                             ThemeOptionButton(
                                 theme: theme,
                                 title: tr(theme.titleKey),
                                 isSelected: effectiveAppGridTheme == theme,
+                                previewTuning: currentThemeTuning(for: theme),
                                 accessory: themeOptionAccessory(for: theme)
                             ) {
                                 handleThemeSelection(theme)
@@ -1100,10 +1307,7 @@
                         }
                     }
 
-                    Text(tr("settings.themeScopeDesc"))
-                        .font(.caption)
-                        .foregroundStyle(.secondary)
-                        .fixedSize(horizontal: false, vertical: true)
+                    themeColorTuningSection
                 }
                 .frame(maxWidth: generalContentWidth, alignment: .leading)
                 .padding(.horizontal)
@@ -1473,8 +1677,16 @@
         .onAppear {
             syncSelectedLanguage()
             showPendingHotkeyWarningIfNeeded()
+            refreshThemePreviewCountdown()
+        }
+        .onDisappear {
+            stopHotkeyRecording()
+        }
+        .onReceive(themePreviewCountdownTimer) { now in
+            refreshThemePreviewCountdown(now: now)
         }
         .onReceive(NotificationCenter.default.publisher(for: .tagLauncherHotkeyRegistrationChanged)) { _ in
+            hotkeySettingsRefreshToken = UUID()
             showPendingHotkeyWarningIfNeeded()
         }
         .onReceive(NotificationCenter.default.publisher(for: .tagLauncherPreferencesTabRequested)) { notification in
@@ -1518,32 +1730,27 @@
     let statusTone: HotkeyStatusTone
 
     var body: some View {
-        VStack(alignment: .leading, spacing: 12) {
-            HStack(alignment: .top, spacing: 12) {
-                VStack(alignment: .leading, spacing: 3) {
-                    Text(title)
-                        .font(.system(size: 13, weight: .semibold))
-                    Text(description)
-                        .font(.caption)
-                        .foregroundStyle(.secondary)
-                        .fixedSize(horizontal: false, vertical: true)
-                }
-                .frame(maxWidth: .infinity, alignment: .leading)
-
-                VStack(alignment: .leading, spacing: 4) {
-                    Text(displayText)
-                        .font(.system(size: 15, weight: .semibold))
-                        .lineLimit(1)
-                        .minimumScaleFactor(0.85)
-                    Text(statusText)
-                        .font(.system(size: 11, weight: .semibold))
-                        .foregroundStyle(statusTone.foreground)
-                        .padding(.horizontal, 8)
-                        .padding(.vertical, 3)
-                        .background(Capsule().fill(statusTone.background))
-                }
-                .frame(width: 180, alignment: .leading)
+        HStack(alignment: .center, spacing: 18) {
+            VStack(alignment: .leading, spacing: 3) {
+                Text(title)
+                    .font(.system(size: 13, weight: .semibold))
+                Text(description)
+                    .font(.caption)
+                    .foregroundStyle(.secondary)
+                    .fixedSize(horizontal: false, vertical: true)
             }
+            .frame(maxWidth: .infinity, alignment: .leading)
+
+            HStack(alignment: .center, spacing: 12) {
+                Text(displayText)
+                    .font(.system(size: 15, weight: .semibold))
+                    .lineLimit(1)
+                    .minimumScaleFactor(0.85)
+                    .frame(width: 156, alignment: .leading)
+
+                HotkeyStatusPill(text: statusText, tone: statusTone)
+            }
+            .frame(width: 310, alignment: .leading)
         }
         .padding(12)
         .background(
@@ -1554,6 +1761,142 @@
             RoundedRectangle(cornerRadius: 8, style: .continuous)
                 .stroke(Color.secondary.opacity(0.14), lineWidth: 1)
         )
+    }
+}
+
+private struct CustomizableHotkeyInfoRow: View {
+    let title: String
+    let description: String
+    let displayText: String
+    let statusText: String
+    let statusTone: HotkeyStatusTone
+    let customizeTitle: String
+    let restoreTitle: String
+    let isRecording: Bool
+    let isProLocked: Bool
+    let canRestore: Bool
+    let onCustomize: () -> Void
+    let onRestore: () -> Void
+
+    var body: some View {
+        HStack(alignment: .center, spacing: 18) {
+            VStack(alignment: .leading, spacing: 3) {
+                Text(title)
+                    .font(.system(size: 13, weight: .semibold))
+                Text(description)
+                    .font(.caption)
+                    .foregroundStyle(.secondary)
+                    .fixedSize(horizontal: false, vertical: true)
+            }
+            .frame(maxWidth: .infinity, alignment: .leading)
+
+            HStack(alignment: .center, spacing: 12) {
+                VStack(alignment: .leading, spacing: 6) {
+                    Text(isRecording ? "…" : displayText)
+                        .font(.system(size: 15, weight: .semibold))
+                        .lineLimit(1)
+                        .minimumScaleFactor(0.85)
+
+                    HStack(spacing: 6) {
+                        HotkeyStatusPill(text: statusText, tone: statusTone)
+
+                        if isRecording {
+                            Text(tr("hotkeys.recordingInline"))
+                                .font(.system(size: 11, weight: .semibold))
+                                .foregroundStyle(.blue)
+                        }
+                    }
+                }
+                .frame(width: 156, alignment: .leading)
+
+                HotkeyPrimaryActionButton(
+                    title: customizeTitle,
+                    isProLocked: isProLocked,
+                    action: onCustomize
+                )
+
+                if canRestore {
+                    HotkeySecondaryActionButton(
+                        title: restoreTitle,
+                        action: onRestore
+                    )
+                }
+            }
+            .frame(width: 310, alignment: .leading)
+        }
+        .padding(12)
+        .background(
+            RoundedRectangle(cornerRadius: 8, style: .continuous)
+                .fill(Color(nsColor: .controlBackgroundColor))
+        )
+        .overlay(
+            RoundedRectangle(cornerRadius: 8, style: .continuous)
+                .stroke(Color.secondary.opacity(0.14), lineWidth: 1)
+        )
+    }
+}
+
+private struct HotkeyStatusPill: View {
+    let text: String
+    let tone: HotkeyStatusTone
+
+    var body: some View {
+        Text(text)
+            .font(.system(size: 11, weight: .semibold))
+            .foregroundStyle(tone.foreground)
+            .lineLimit(1)
+            .padding(.horizontal, 8)
+            .padding(.vertical, 3)
+            .background(Capsule().fill(tone.background))
+    }
+}
+
+private struct HotkeyPrimaryActionButton: View {
+    let title: String
+    let isProLocked: Bool
+    let action: () -> Void
+
+    var body: some View {
+        Button(action: action) {
+            if isProLocked {
+                ProStatusPill(text: title, style: .locked, compact: true)
+            } else {
+                Text(title)
+                    .font(.system(size: 11, weight: .semibold))
+                    .foregroundStyle(Color.white)
+                    .lineLimit(1)
+                    .padding(.horizontal, 12)
+                    .padding(.vertical, 6)
+                    .background(
+                        Capsule(style: .continuous)
+                            .fill(Color.accentColor)
+                    )
+            }
+        }
+        .buttonStyle(.plain)
+        .contentShape(Capsule(style: .continuous))
+    }
+}
+
+private struct HotkeySecondaryActionButton: View {
+    let title: String
+    let action: () -> Void
+
+    var body: some View {
+        Button(action: action) {
+            Text(title)
+                .font(.system(size: 11, weight: .semibold))
+                .foregroundStyle(.secondary)
+                .lineLimit(1)
+                .padding(.horizontal, 12)
+                .padding(.vertical, 6)
+                .background(
+                    Capsule(style: .continuous)
+                        .fill(Color.secondary.opacity(0.12))
+                )
+        }
+        .buttonStyle(.plain)
+        .contentShape(Capsule(style: .continuous))
     }
 }
 
@@ -1662,6 +2005,7 @@
 private enum ThemeOptionAccessory {
     case checkmark
     case circle
+    case countdown(text: String)
     case pill(text: String, style: ProStatusPillStyle)
 }
 
@@ -1669,6 +2013,7 @@
     let theme: AppGridTheme
     let title: String
     let isSelected: Bool
+    let previewTuning: Double
     let accessory: ThemeOptionAccessory
     let action: () -> Void
 
@@ -1678,7 +2023,7 @@
                 RoundedRectangle(cornerRadius: 8, style: .continuous)
                     .fill(
                         LinearGradient(
-                            colors: theme.previewColors,
+                            colors: theme.previewColors(tuning: previewTuning),
                             startPoint: .topLeading,
                             endPoint: .bottomTrailing
                         )
@@ -1739,6 +2084,22 @@
             Image(systemName: "circle")
                 .font(.system(size: 16, weight: .semibold))
                 .foregroundStyle(Color.secondary.opacity(0.42))
+        case .countdown(let text):
+            Text(text)
+                .font(.system(size: 10, weight: .semibold, design: .monospaced))
+                .foregroundStyle(Color(red: 0.30, green: 0.22, blue: 0.08))
+                .lineLimit(1)
+                .frame(minWidth: 42)
+                .padding(.horizontal, 8)
+                .padding(.vertical, 4)
+                .background(
+                    Capsule(style: .continuous)
+                        .fill(Color.orange.opacity(0.14))
+                )
+                .overlay(
+                    Capsule(style: .continuous)
+                        .stroke(Color.orange.opacity(0.28), lineWidth: 1)
+                )
         case .pill(let text, let style):
             ProStatusPill(text: text, style: style, compact: true)
         }

--
Gitblit v1.9.3