<script setup lang="ts">
import {
  AppstoreOutlined,
  BugOutlined,
  DownloadOutlined,
  LinkOutlined,
  LogoutOutlined,
  RobotOutlined,
  SendOutlined,
  SettingOutlined,
} from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { computed, onMounted, ref, watch } from 'vue'
import { RouterLink, RouterView, useRoute } from 'vue-router'

import iconWithTitle from '@brand-logo-full'
import { useClientRelease } from '../composables/useClientRelease'
import { useDesktopRuntime } from '../composables/useDesktopRuntime'
import { useDesktopSession } from '../composables/useDesktopSession'
import { desktopMonitoringMediaCatalog, desktopPublishMediaCatalog } from '../lib/media-catalog'

const route = useRoute()
const { snapshot, error, refreshAccounts } = useDesktopRuntime()
const { session, logout } = useDesktopSession()
const {
  check: checkClientRelease,
  startUpdate: startClientUpdate,
  openManualDownload,
  updateProgress,
  updateError,
  updateManualDownloadRequired,
  manualDownloadLoading,
  updating,
} = useClientRelease()
let hasCheckedClientRelease = false
const updateModalOpen = ref(false)
const updateModalVersion = ref('')
const updateModalForce = ref(false)
const updateModalStarted = ref(false)
const bugReportOpen = ref(false)
const bugReportSubmitting = ref(false)
type BugReportSeverity = 'low' | 'medium' | 'high' | 'critical'
const bugReportForm = ref({
  title: '',
  description: '',
  severity: 'medium' as BugReportSeverity,
})

const accountAwareRoutes = new Set(['/media-platforms', '/ai-platforms'])

function handleNavClick(target: string) {
  if (accountAwareRoutes.has(target)) {
    void refreshAccounts()
  }
}

const navItems = computed(() => {
  const data = snapshot.value
  const accounts = data?.accounts ?? []
  const publishIDs = new Set(desktopPublishMediaCatalog.map((item) => item.id))
  const monitoringIDs = new Set(desktopMonitoringMediaCatalog.map((item) => item.id))

  return [
    {
      to: '/',
      title: '控制台',
      description: '运行总览、活动流和总体健康度',
      count: data?.summary.issuesOpen ?? 0,
      icon: AppstoreOutlined,
    },
    {
      to: '/publish-management',
      title: '发布管理',
      description: '查看待发布队列、历史发送结果和账号工作台',
      count: data?.summary.queuedTasks ?? 0,
      icon: SendOutlined,
    },
    {
      to: '/media-platforms',
      title: '媒体账号',
      description: '发布媒体授权、多个账号绑定管理',
      count: accounts.filter((item) => publishIDs.has(item.platform)).length,
      icon: LinkOutlined,
    },
    {
      to: '/ai-platforms',
      title: 'AI 平台',
      description: 'AI 平台一平台一授权，按卡片查看状态与归属',
      count: accounts.filter((item) => monitoringIDs.has(item.platform)).length,
      icon: RobotOutlined,
    },
  ]
})

const operatorName = computed(() => {
  const user = session.value?.user
  return user?.name?.trim() || user?.phone?.trim() || user?.email?.trim() || '未命名操作员'
})
const operatorEmail = computed(() => {
  const user = session.value?.user
  const email = user?.email?.trim()
  const phone = user?.phone?.trim()
  if (email && phone && email !== operatorName.value) {
    return email
  }
  return phone && phone !== operatorName.value ? phone : ''
})
const liveClientLabel = computed(() => snapshot.value?.clients[0]?.deviceName ?? null)
const clientLabel = computed(
  () =>
    liveClientLabel.value ?? session.value?.desktopClient?.device_name ?? '当前设备尚未注册 client',
)
const updateProgressPercent = computed(() => {
  const percent = updateProgress.value?.percent
  if (typeof percent !== 'number' || !Number.isFinite(percent)) {
    return null
  }
  return Math.max(0, Math.min(100, Math.round(percent)))
})
const updateProgressLabel = computed(() => {
  if (isUpdateFailed.value) {
    return '热更新失败，请去官网更新'
  }
  switch (updateProgress.value?.stage) {
    case 'checking':
      return '正在准备更新'
    case 'downloading':
      return updateProgressPercent.value === null
        ? '正在下载更新'
        : `正在下载 ${updateProgressPercent.value}%`
    case 'downloaded':
      return '下载完成，准备安装'
    case 'installing':
      return '正在重启安装'
    case 'not-available':
      return '当前已是最新版本'
    default:
      return updateModalStarted.value ? '正在准备更新' : ''
  }
})
const isUpdateFailed = computed(() => Boolean(updateError.value))
const updateProgressBarPercent = computed(() => {
  if (!updateModalStarted.value) {
    return 0
  }
  if (updateProgress.value?.stage === 'checking') {
    return 8
  }
  if (
    updateProgress.value?.stage === 'downloaded' ||
    updateProgress.value?.stage === 'installing'
  ) {
    return 100
  }
  return updateProgressPercent.value ?? 8
})
const updatePrimaryLabel = computed(() => {
  if (!updateModalStarted.value) {
    return '立即更新'
  }
  if (updating.value) {
    return '更新中'
  }
  return updateError.value ? '重试更新' : '立即更新'
})
const updateModalEyebrow = computed(() => {
  if (isUpdateFailed.value) {
    return '热更新失败'
  }
  return updateModalForce.value ? '必须更新' : '发现新版本'
})
const updateModalTitle = computed(() => {
  if (isUpdateFailed.value) {
    return '热更新失败，请去官网更新'
  }
  return '发现新的客户端版本'
})
const updateModalDescription = computed(() => {
  if (isUpdateFailed.value) {
    return `最新版本 ${updateModalVersion.value} 已可下载，请前往官网下载安装包后手动更新。`
  }
  return `最新版本 ${updateModalVersion.value} 已可下载。自动更新失败时会打开官网下载地址。`
})

function openSettingsWindow() {
  void window.desktopBridge.app.openSettingsWindow()
}

function openBugReportDialog() {
  bugReportForm.value = {
    title: '',
    description: '',
    severity: 'medium' as BugReportSeverity,
  }
  bugReportOpen.value = true
}

async function submitBugReport() {
  const title = bugReportForm.value.title.trim()
  const description = bugReportForm.value.description.trim()
  if (!title || !description) {
    return
  }
  bugReportSubmitting.value = true
  try {
    const result = await window.desktopBridge.app.submitBugReport({
      title,
      description,
      severity: bugReportForm.value.severity,
    })
    bugReportOpen.value = false
    message.success(`反馈已提交：${result.id}`)
  } catch (error) {
    message.error(error instanceof Error ? error.message : '反馈提交失败')
  } finally {
    bugReportSubmitting.value = false
  }
}

async function startClientReleaseUpdate() {
  updateModalStarted.value = true
  const updated = await startClientUpdate()
  if (updated) {
    return
  }
}

function notifyClientUpdate(latestVersion: string, forceUpdate: boolean) {
  updateModalVersion.value = latestVersion
  updateModalForce.value = forceUpdate
  updateModalStarted.value = false
  updateModalOpen.value = true
}

function closeUpdateModal() {
  if (isUpdateFailed.value || updateModalForce.value || updating.value) {
    return
  }
  updateModalOpen.value = false
}

function openUpdateManualDownload() {
  void openManualDownload()
}

function quitApp() {
  void window.desktopBridge.app.quitApp()
}

async function checkClientReleaseOnce() {
  if (hasCheckedClientRelease || !session.value?.clientToken) {
    return
  }
  hasCheckedClientRelease = true
  const result = await checkClientRelease('silent')
  if (!result?.update_available) {
    return
  }
  notifyClientUpdate(result.latest_version, result.force_update)
}

onMounted(() => {
  void checkClientReleaseOnce()
})

watch(
  () => session.value?.clientToken,
  () => {
    void checkClientReleaseOnce()
  },
)
</script>

<template>
  <div class="app-shell">
    <div class="window-drag-bar" aria-hidden="true"></div>
    <aside class="sidebar">
      <div class="brand-block">
        <img :src="iconWithTitle" alt="省心推" class="brand-logo-full" />
      </div>

      <nav class="nav">
        <RouterLink
          v-for="item in navItems"
          :key="item.to"
          :to="item.to"
          class="nav-link"
          :class="{ active: route.path === item.to }"
          @click="handleNavClick(item.to)"
        >
          <div class="nav-copy">
            <component :is="item.icon" class="nav-icon" />
            <strong>{{ item.title }}</strong>
          </div>
          <span class="nav-count">{{ item.count }}</span>
        </RouterLink>
      </nav>

      <footer class="sidebar-footer">
        <section class="user-profile-panel">
          <div class="user-info-row">
            <div class="user-avatar">{{ operatorName.charAt(0).toUpperCase() }}</div>
            <div class="user-details">
              <strong>{{ operatorName }}</strong>
              <p>{{ operatorEmail }}</p>
            </div>
          </div>
          <div class="user-actions-row">
            <a-tooltip :title="clientLabel" placement="top">
              <div class="device-tag">
                <span class="status-dot"></span>
                <span class="device-name-text">{{ clientLabel }}</span>
              </div>
            </a-tooltip>
            <div class="action-cluster">
              <a-tooltip title="反馈问题" placement="top">
                <button type="button" class="footer-icon-btn" @click="openBugReportDialog">
                  <BugOutlined />
                </button>
              </a-tooltip>
              <a-tooltip title="设置" placement="top">
                <button type="button" class="footer-icon-btn" @click="openSettingsWindow">
                  <SettingOutlined />
                </button>
              </a-tooltip>
              <a-tooltip title="退出登录" placement="top">
                <button
                  type="button"
                  class="footer-icon-btn footer-icon-btn--danger"
                  @click="logout"
                >
                  <LogoutOutlined />
                </button>
              </a-tooltip>
            </div>
          </div>
        </section>

        <div class="footer-bottom-row">
          <span class="version-label">Version</span>
          <strong class="version-value">{{ snapshot?.app.version ?? '0.1.0' }}</strong>
        </div>
        <p v-if="error" class="error-text">{{ error }}</p>
      </footer>
    </aside>

    <main class="content">
      <div class="content-dragbar" aria-hidden="true"></div>
      <RouterView />
    </main>

    <a-modal
      v-model:open="updateModalOpen"
      :closable="!isUpdateFailed && !updateModalForce && !updating"
      :mask-closable="!isUpdateFailed && !updateModalForce && !updating"
      :keyboard="!isUpdateFailed && !updateModalForce && !updating"
      :footer="null"
      width="520px"
      centered
      class="client-update-modal"
      @cancel="closeUpdateModal"
    >
      <section class="client-update-dialog">
        <div class="client-update-dialog__mark">
          <DownloadOutlined />
        </div>
        <div class="client-update-dialog__copy">
          <span>{{ updateModalEyebrow }}</span>
          <h2>{{ updateModalTitle }}</h2>
          <p>{{ updateModalDescription }}</p>
          <button
            v-if="isUpdateFailed"
            type="button"
            class="client-update-link-button"
            :disabled="manualDownloadLoading"
            @click="openUpdateManualDownload"
          >
            <DownloadOutlined />
            {{ manualDownloadLoading ? '正在打开更新包链接' : '打开更新包链接' }}
          </button>
        </div>

        <div v-if="updateModalStarted && !isUpdateFailed" class="client-update-progress">
          <div class="client-update-progress__meta">
            <strong>{{ updateProgressLabel }}</strong>
            <span v-if="updateProgressPercent !== null">{{ updateProgressPercent }}%</span>
          </div>
          <div class="client-update-progress__bar">
            <span :style="{ width: `${updateProgressBarPercent}%` }"></span>
          </div>
        </div>

        <div class="client-update-dialog__actions">
          <button
            v-if="isUpdateFailed"
            type="button"
            class="client-update-button client-update-button--primary"
            @click="quitApp"
          >
            退出
          </button>
          <button
            v-else-if="!updateModalForce"
            type="button"
            class="client-update-button client-update-button--ghost"
            :disabled="updating"
            @click="closeUpdateModal"
          >
            稍后
          </button>
          <button
            v-if="!isUpdateFailed && updateManualDownloadRequired"
            type="button"
            class="client-update-button client-update-button--ghost"
            :disabled="manualDownloadLoading"
            @click="openUpdateManualDownload"
          >
            <DownloadOutlined />
            {{ manualDownloadLoading ? '打开中' : '官网下载' }}
          </button>
          <button
            v-if="!isUpdateFailed"
            type="button"
            class="client-update-button client-update-button--primary"
            :disabled="updating"
            @click="startClientReleaseUpdate"
          >
            <DownloadOutlined />
            {{ updatePrimaryLabel }}
          </button>
        </div>
      </section>
    </a-modal>

    <a-modal
      v-model:open="bugReportOpen"
      title="反馈客户端问题"
      :confirm-loading="bugReportSubmitting"
      ok-text="提交"
      cancel-text="取消"
      :ok-button-props="{
        disabled: !bugReportForm.title.trim() || !bugReportForm.description.trim(),
      }"
      @ok="submitBugReport"
    >
      <a-form layout="vertical" :model="bugReportForm">
        <a-form-item label="标题" required>
          <a-input
            v-model:value="bugReportForm.title"
            placeholder="例如：发布时客户端卡住"
            :maxlength="120"
          />
        </a-form-item>
        <a-form-item label="严重级别">
          <a-segmented
            v-model:value="bugReportForm.severity"
            :options="[
              { label: '低', value: 'low' },
              { label: '中', value: 'medium' },
              { label: '高', value: 'high' },
              { label: '致命', value: 'critical' },
            ]"
          />
        </a-form-item>
        <a-form-item label="现象描述" required>
          <a-textarea
            v-model:value="bugReportForm.description"
            placeholder="请描述刚才做了什么、看到了什么异常"
            :maxlength="2000"
            :rows="5"
          />
        </a-form-item>
      </a-form>
    </a-modal>
  </div>
</template>

<style scoped>
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: #f0f2f5;
  color: #1a1a1a;
  position: relative;
}

/* Real drag handle for the macOS hidden title bar — must be above content
   but only spans the empty zone behind the traffic lights. */
.window-drag-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 144px;
  height: 24px;
  z-index: 1000;
  -webkit-app-region: drag;
}

:global(html[data-platform='darwin']) .window-drag-bar {
  left: 80px;
  right: 0;
  height: 28px;
}

.app-shell :where(button, a, input, select, textarea, [role='button'], [role='link']) {
  -webkit-app-region: no-drag;
}

.sidebar {
  width: 320px;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 24px;
  padding-top: 44px;
  border-right: 1px solid #e6edf5;
  background: #ffffff;
  flex-shrink: 0;
}

.brand-block {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  -webkit-app-region: drag;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, #6e55ff 0%, #00c6ff 100%);
  box-shadow: 0 6px 14px rgba(110, 85, 255, 0.28);
}

.brand-mark-img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.brand-logo-full {
  height: 40px;
  max-width: 100%;
  display: block;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 4px;
  color: #8c8c8c;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: auto 0;
}

.nav-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
  background: #f8fafc;
}

.nav-link.active {
  background: #e6f4ff;
  border-color: #e6f4ff;
}

.nav-copy {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon {
  font-size: 16px;
  color: #8c8c8c;
  transition: color 0.2s;
}

.nav-link:hover .nav-icon {
  color: #595959;
}

.nav-link.active .nav-icon {
  color: #1677ff;
}

.nav-copy strong {
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
}

.nav-link:hover .nav-copy strong {
  color: #1f2937;
}

.nav-link.active .nav-copy strong {
  color: #1677ff;
  font-weight: 600;
}

.nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 14px;
  background: #f0f0f0;
  color: #595959;
  font-size: 13px;
  font-weight: 600;
}

.nav-link.active .nav-count {
  background: #1677ff;
  color: #fff;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
}

.user-profile-panel {
  padding: 16px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.02),
    0 2px 4px -2px rgba(0, 0, 0, 0.01);
  transition: all 0.2s ease;
}

.user-profile-panel:hover {
  border-color: #cbd5e1;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.03),
    0 2px 4px -2px rgba(0, 0, 0, 0.02);
}

.user-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0f172a;
  color: #ffffff;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-details {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-details strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.user-details p {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.user-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #e2e8f0;
  gap: 8px;
}

.device-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  min-width: 0;
}

.device-tag .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 2px #d1fae5;
  flex-shrink: 0;
}

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

.action-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #94a3b8;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.footer-icon-btn:hover {
  background: #f1f5f9;
  color: #1677ff;
  border-color: #e2e8f0;
}

.footer-icon-btn.router-link-active {
  background: #e6f4ff;
  color: #1677ff;
  border-color: #e6f4ff;
}

.footer-icon-btn--danger:hover {
  background: #fef2f2;
  color: #ef4444;
  border-color: #fee2e2;
}

.footer-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.version-label {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 500;
}

.version-value {
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.error-text {
  margin: 0;
  color: #ef4444;
  font-size: 13px;
}

.content {
  flex: 1;
  min-width: 0;
  height: 100vh;
  padding: 24px 32px;
  overflow-y: auto;
  position: relative;
}

.content-dragbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 24px;
  margin: -24px -32px 0;
  -webkit-app-region: drag;
  z-index: 5;
}

:global(.client-update-modal .ant-modal-content) {
  overflow: hidden;
  border-radius: 12px;
  padding: 0;
  box-shadow:
    0 22px 48px rgba(15, 23, 42, 0.18),
    0 8px 18px rgba(15, 23, 42, 0.08);
}

:global(.client-update-modal .ant-modal-close) {
  top: 18px;
  right: 18px;
}

.client-update-dialog {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 34px 36px 30px;
  background: #ffffff;
}

.client-update-dialog__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #e6f4ff;
  color: #1677ff;
  font-size: 20px;
}

.client-update-dialog__copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.client-update-dialog__copy span {
  color: #1677ff;
  font-size: 13px;
  font-weight: 800;
}

.client-update-dialog__copy h2 {
  margin: 0;
  color: #111827;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25;
}

.client-update-dialog__copy p {
  margin: 0;
  color: #374151;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.75;
}

.client-update-link-button {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 0 2px;
  border: 0;
  border-bottom: 2px solid rgba(22, 119, 255, 0.28);
  background: transparent;
  color: #1677ff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  transition:
    border-color 0.2s ease,
    color 0.2s ease,
    opacity 0.2s ease;
}

.client-update-link-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.client-update-link-button:not(:disabled):hover {
  border-color: #1677ff;
  color: #0958d9;
}

.client-update-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.client-update-progress__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #64748b;
  font-size: 13px;
}

.client-update-progress__meta strong {
  min-width: 0;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.client-update-progress__meta span {
  color: #1677ff;
  font-weight: 800;
}

.client-update-progress__bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.client-update-progress__bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #1677ff;
  transition: width 0.2s ease;
}

.client-update-dialog__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.client-update-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 104px;
  height: 40px;
  padding: 0 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    opacity 0.2s ease;
}

.client-update-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.client-update-button--primary {
  border: 1px solid #1677ff;
  background: #1677ff;
  color: #ffffff;
}

.client-update-button--primary:not(:disabled):hover {
  background: #0958d9;
  border-color: #0958d9;
}

.client-update-button--ghost {
  border: 1px solid #dbe3ee;
  background: #ffffff;
  color: #475569;
}

.client-update-button--ghost:not(:disabled):hover {
  border-color: #b6cff5;
  color: #1677ff;
  background: #f8fbff;
}

@media (max-width: 1080px) {
  .sidebar {
    width: 260px;
  }
}
</style>
