.ak-page {
  --ak-primary: #007aff;
  --ak-primary-dark: #0066d6;
  --ak-border: rgba(60, 60, 67, 0.12);
  --ak-bg: #f5f5f7;
  --ak-text: #111827;
  --ak-sub: #6b7280;
  --ak-radius: 8px;
  --ak-topbar-height: 52px;
  --ak-topbar-gap: 0px;
  --ak-secondary-bar-height: 56px;
  --ak-sidebar-width: 220px;
  --ak-layout-top-offset: calc(var(--ak-topbar-height) + var(--ak-topbar-gap));
  background: var(--ak-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ak-layout {
  max-width: 1680px;
  margin: 12px auto;
  padding: 0 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ak-card {
  background: #fff;
  border: 1px solid var(--ak-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.ak-keywords-card {
  overflow: hidden;
}

.ak-page header.topbar {
  margin-bottom: 0 !important;
}

.ak-keywords-card #tableContainer {
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}
.ak-keywords-card #tableContainer::-webkit-scrollbar {
  display: none; /* Webkit */
}
.ak-keywords-card .ak-table {
  border: none;
  table-layout: fixed;
}

/* 关键词表：非常淡的竖分隔线（苹果风） */
.ak-keywords-card .ak-table th:not(:last-child),
.ak-keywords-card .ak-table td:not(:last-child) {
  border-right: 1px solid rgba(60, 60, 67, 0.06);
}

.ak-section {
  padding: 12px;
}

.ak-app-header {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}
.ak-app-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: #f1f5f9;
  border: 1px solid #e5e7eb;
}
.ak-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--ak-border);
  background: #fff;
  color: #374151;
  font-size: 12px;
}
.ak-copy-chip {
  cursor: pointer;
  user-select: none;
}
.ak-copy-chip:hover {
  border-color: rgba(0, 122, 255, 0.45);
  background: rgba(0, 122, 255, 0.06);
}
.ak-tag.secondary {
  border-color: #e5e7eb;
  color: #9ca3af;
}
.ak-tag.active {
  background: rgba(0, 122, 255, 0.08);
  border-color: rgba(0, 122, 255, 0.35);
  color: #0b4aa2;
}
.ak-tag.disabled {
  background: #f8fafc;
  border-style: dashed;
  color: #cbd5e1;
  cursor: not-allowed;
}
.ak-meta {
  font-size: 12px;
  color: #9ca3af;
}

/* 关键词管理：头部 AppleId + 空间按钮行 */
.ak-header-meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.ak-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ak-text);
}

.ak-sub {
  font-size: 12px;
  color: var(--ak-sub);
  margin-top: 4px;
}

.ak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--ak-border);
  background: #fff;
  color: var(--ak-text);
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s;
}
.ak-btn:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}
.ak-btn.primary {
  background: var(--ak-primary);
  border-color: var(--ak-primary);
  color: #fff;
}
.ak-btn.primary:hover {
  background: var(--ak-primary-dark);
  border-color: var(--ak-primary-dark);
}
.ak-btn.soft {
  background: rgba(0, 122, 255, 0.08);
  border-color: rgba(0, 122, 255, 0.35);
  color: #0b4aa2;
}
.ak-btn.soft:hover {
  background: rgba(0, 122, 255, 0.12);
  border-color: rgba(0, 122, 255, 0.45);
}
.ak-btn.soft:active {
  background: rgba(0, 122, 255, 0.16);
  border-color: rgba(0, 122, 255, 0.55);
}
.ak-btn.danger {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.06);
  color: #b91c1c;
}
.ak-btn.danger:hover {
  border-color: rgba(220, 38, 38, 0.55);
  background: rgba(220, 38, 38, 0.1);
}
.ak-btn.text {
  border-color: transparent;
  background: transparent;
  color: var(--ak-sub);
}
.ak-btn.subtle {
  background: #f8fafc;
  color: #6b7280;
  border-color: #e5e7eb;
}

.ak-input,
.ak-select,
.ak-input input {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--ak-border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 400;
  color: var(--ak-text);
  background: #fff;
  outline: none;
}

/* 数字输入：去掉上下微调“滑轮”，并留出更干净的输入空间 */
.ak-input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
.ak-input[type="number"]::-webkit-outer-spin-button,
.ak-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ak-input:focus,
.ak-select:focus,
.ak-input input:focus {
  border-color: var(--ak-primary);
}

.ak-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.ak-batch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ak-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--ak-border);
  table-layout: fixed;
}
.ak-table thead tr {
  background: transparent;
}
.ak-table th,
.ak-table td {
  border-bottom: 1px solid rgba(60, 60, 67, 0.1);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--ak-text);
  text-align: left;
  vertical-align: middle;
  line-height: 1.2;
}
.ak-table th {
  color: rgba(60, 60, 67, 0.78);
  font-weight: 500;
  background: rgba(60, 60, 67, 0.04);
  white-space: nowrap;
}
.ak-table tbody tr:last-child td {
  border-bottom: none;
}
.ak-table tbody .ak-row:nth-child(even) {
  background: rgba(60, 60, 67, 0.018);
}
.ak-table tbody .ak-row:hover {
  background: rgba(0, 122, 255, 0.06);
}

.ak-sf-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ak-sf-code {
  flex: 0 0 auto;
  font-weight: 600;
  font-size: 12px;
  color: rgba(60, 60, 67, 0.72);
}

.ak-sf-name {
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.ak-genre-cell {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.ak-genre-zh {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.95);
}

.ak-genre-en {
  font-size: 12px;
  color: rgba(60, 60, 67, 0.7);
}

.ak-rank-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ak-trend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  font-size: 12px;
  line-height: 1;
}

.ak-trend.up {
  color: rgba(34, 197, 94, 0.95);
}

.ak-trend.down {
  color: rgba(239, 68, 68, 0.95);
}

.ak-trend.flat {
  color: rgba(148, 163, 184, 0.95);
}

.ak-keywords-card .ak-table th:nth-child(1),
.ak-keywords-card .ak-table th:nth-child(2),
.ak-keywords-card .ak-table th:nth-child(5),
.ak-keywords-card .ak-table th:nth-child(6),
.ak-keywords-card .ak-table th:nth-child(7),
.ak-keywords-card .ak-table th:nth-child(8),
.ak-keywords-card .ak-table th:nth-child(9),
.ak-keywords-card .ak-table th:nth-child(10),
.ak-keywords-card .ak-table th:nth-child(11),
.ak-keywords-card .ak-table th:nth-child(12),
.ak-keywords-card .ak-table th:nth-child(13),
.ak-keywords-card .ak-table td:nth-child(1),
.ak-keywords-card .ak-table td:nth-child(2),
.ak-keywords-card .ak-table td:nth-child(5),
.ak-keywords-card .ak-table td:nth-child(6),
.ak-keywords-card .ak-table td:nth-child(7),
.ak-keywords-card .ak-table td:nth-child(8),
.ak-keywords-card .ak-table td:nth-child(9),
.ak-keywords-card .ak-table td:nth-child(10),
.ak-keywords-card .ak-table td:nth-child(11),
.ak-keywords-card .ak-table td:nth-child(12),
.ak-keywords-card .ak-table td:nth-child(13) {
  text-align: center;
}

/* 流行度：进度条 + 数值（0-100） */
.ak-popularity {
  position: relative;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
.ak-popularity::before {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 6px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
}
.ak-popularity::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  height: 6px;
  transform: translateY(-50%);
  width: calc((100% - 16px) * (var(--ak-pop, 0) / 100));
  border-radius: 999px;
  background: var(--ak-pop-color, #9ca3af);
  opacity: 0.35;
}
.ak-pop-num {
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
}

.ak-keywords-card .ak-table td:nth-child(3) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 投放时间列：避免长字符串撑爆表格 */
.ak-keywords-card .ak-table td:nth-child(11) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ak-delivery {
  display: inline-block;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(60, 60, 67, 0.06);
  border: 1px solid rgba(60, 60, 67, 0.1);
  color: rgba(60, 60, 67, 0.78);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ak-delivery.is-empty {
  background: transparent;
  border-color: transparent;
  color: rgba(60, 60, 67, 0.45);
}
.ak-flag {
  max-width: 100%;
  overflow: hidden;
}

.ak-app-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 4px 8px;
}

/* 关键词管理：应用卡片下方的“权限/空间”信息行（避免卡片内拥挤） */
.ak-app-tile-meta {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ak-app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.ak-app-overall-slot {
  height: 22px;
}
.ak-app-overall-entry {
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(60, 60, 67, 0.12);
  background: rgba(60, 60, 67, 0.04);
  color: rgba(60, 60, 67, 0.72);
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ak-app-overall-entry:hover {
  background: rgba(0, 122, 255, 0.06);
  border-color: rgba(0, 122, 255, 0.22);
  color: rgba(0, 122, 255, 0.95);
}
.ak-app-overall-entry.is-open {
  background: rgba(0, 122, 255, 0.12);
  border-color: rgba(0, 122, 255, 0.28);
  color: rgba(0, 122, 255, 0.95);
}
.ak-app-overall-entry.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.ak-app-summary-card {
  position: relative;
}
.ak-app-summary-card .ak-app-list-row {
  padding-right: 12px;
}
.ak-total-count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: inherit;
  color: rgba(60, 60, 67, 0.60);
  white-space: nowrap;
  pointer-events: none;
}
.ak-total-count--table {
  position: static;
  right: auto;
  bottom: auto;
  pointer-events: none;
}
.ak-total-count-value {
  font-weight: 600;
  color: rgba(60, 60, 67, 0.78);
  font-variant-numeric: tabular-nums;
}
.ak-app-card {
  width: 70px;
  padding: 5px;
  border: 1px solid var(--ak-border);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}
.ak-app-card.active {
  border-color: var(--ak-primary);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.12);
}
.ak-app-card img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  margin: 0 auto 6px;
  background: #f1f5f9;
}
.ak-app-card .name {
  font-size: 12px;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ak-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ak-sub);
  width: 100%;
  min-width: 0;
}

.ak-flag-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ak-flag .ak-warn {
  margin-left: auto;
}

.ak-overall-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ak-overall-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
}
.ak-overall-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ak-overall-title-group .ak-title {
  margin: 0;
}
.ak-overall-title-group .ak-sub {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}
.ak-overall-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}
.ak-overall-storefront {
  min-width: 160px;
}
.ak-overall-storefront .rs-trigger {
  width: 100%;
  justify-content: flex-start;
  min-width: 160px;
}
.ak-overall-storefront .rs-trigger .label {
  max-width: 200px;
}
.ak-overall-storefront .rs-trigger .chevron {
  margin-left: auto;
}
#overallStorefrontDropdown .rs-item.is-selected {
  background: rgba(0, 122, 255, 0.06);
  border-color: rgba(0, 122, 255, 0.22);
}
.ak-overall-view-seg {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(60, 60, 67, 0.12);
  background: rgba(60, 60, 67, 0.04);
}
.ak-overall-view-btn {
  border: none;
  background: transparent;
  color: rgba(60, 60, 67, 0.72);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.ak-overall-view-btn.is-active {
  background: #fff;
  color: rgba(0, 122, 255, 0.95);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.ak-overall-seg {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(60, 60, 67, 0.12);
  background: rgba(60, 60, 67, 0.04);
}
.ak-overall-seg-btn {
  border: none;
  background: transparent;
  color: rgba(60, 60, 67, 0.72);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.ak-overall-seg-btn.is-active {
  background: #fff;
  color: rgba(0, 122, 255, 0.95);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

/* 顶部对比面板 */
.ak-overall-compare-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ak-overall-compare-panel::-webkit-scrollbar {
  display: none;
}
.ak-overall-compare-list {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.ak-overall-compare-list .ak-overall-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(60, 60, 67, 0.04);
  border: 1px solid rgba(60, 60, 67, 0.08);
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
  transition: all 0.15s;
}
.ak-overall-compare-list .ak-overall-item:hover {
  background: rgba(60, 60, 67, 0.08);
}
.ak-overall-compare-list .ak-overall-item.is-selected {
  background: rgba(0, 122, 255, 0.08);
  border-color: rgba(0, 122, 255, 0.2);
}
.ak-overall-compare-list .ak-overall-item-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ak-overall-compare-list .ak-overall-item-left input[type='checkbox'] {
  width: 14px;
  height: 14px;
  accent-color: var(--ak-primary);
  margin: 0;
}
.ak-overall-compare-list .ak-overall-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ak-overall-compare-list .ak-overall-name {
  font-size: 12px;
  color: rgba(60, 60, 67, 0.82);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ak-overall-compare-list .ak-overall-item-right {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  margin-left: auto;
}
.ak-overall-compare-list .ak-overall-rank {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.ak-overall-compare-list .ak-overall-meta {
  font-size: 10px;
  color: rgba(60, 60, 67, 0.55);
}
.ak-overall-compare-list .ak-overall-list-section {
  font-size: 11px;
  font-weight: 500;
  color: rgba(60, 60, 67, 0.55);
  padding: 0 6px;
  white-space: nowrap;
}

/* 右侧预留面板 */
.ak-overall-right-panel {
  height: 320px;
  border-radius: 12px;
  border: 1px dashed rgba(60, 60, 67, 0.12);
  background: rgba(60, 60, 67, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(60, 60, 67, 0.35);
  font-size: 12px;
}

.ak-overall-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  align-items: start;
}
@media (max-width: 1024px) {
  .ak-overall-grid {
    grid-template-columns: 1fr;
  }
}
.ak-overall-canvas {
  position: relative;
  height: 320px;
  border-radius: 12px 0 0 12px;
  border: 1px solid rgba(60, 60, 67, 0.08);
  border-right: none;
  background: rgba(60, 60, 67, 0.02);
  overflow: hidden;
}
.ak-overall-canvas canvas {
  width: 100% !important;
  height: 100% !important;
}
.ak-overall-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(6px);
}
.ak-overall-overlay-text {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(60, 60, 67, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: rgba(60, 60, 67, 0.78);
  font-size: 12px;
}
.ak-overall-empty {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(60, 60, 67, 0.55);
}
.ak-overall-list-panel {
  height: 320px;
  border-radius: 12px;
  border: 1px solid rgba(60, 60, 67, 0.08);
  background: rgba(60, 60, 67, 0.02);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ak-overall-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(60, 60, 67, 0.06);
}
.ak-overall-list-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(60, 60, 67, 0.82);
}
.ak-overall-list-meta {
  font-size: 12px;
  color: rgba(60, 60, 67, 0.60);
  font-variant-numeric: tabular-nums;
}
.ak-overall-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}
.ak-overall-list-section {
  padding: 8px 6px 4px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(60, 60, 67, 0.55);
}
.ak-overall-list-empty {
  padding: 10px 6px;
  font-size: 12px;
  color: rgba(60, 60, 67, 0.55);
}
.ak-overall-item--metric .ak-overall-name {
  font-weight: 600;
}
.ak-overall-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 6px;
  border-radius: 10px;
}
.ak-overall-item:hover {
  background: rgba(60, 60, 67, 0.05);
}
.ak-overall-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ak-overall-item-left input[type='checkbox'] {
  width: 14px;
  height: 14px;
  accent-color: var(--ak-primary);
}
.ak-overall-color {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
  flex: 0 0 auto;
}
.ak-overall-name {
  font-size: 12px;
  color: rgba(60, 60, 67, 0.82);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ak-overall-item-right {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex: 0 0 auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ak-overall-rank {
  font-size: 12px;
  font-weight: 600;
  color: rgba(0, 122, 255, 0.95);
  white-space: nowrap;
}
.ak-overall-meta {
  font-size: 12px;
  color: rgba(60, 60, 67, 0.55);
  white-space: nowrap;
}

.ak-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(0, 122, 255, 0.08);
  border: 1px solid rgba(0, 122, 255, 0.25);
  font-size: 12px;
  color: #374151;
}

.ak-switch {
  position: relative;
  width: 28px;
  height: 14px;
  background: #e6e6e6;
  border-radius: 18px;
  cursor: pointer;
  transition: background 0.15s;
}
.ak-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s;
}
.ak-switch.active {
  background: var(--ak-primary);
}
.ak-switch.active::after {
  transform: translateX(14px);
}

.ak-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(0, 122, 255, 0.08);
  border: 1px solid transparent;
  color: rgba(11, 74, 162, 0.92);
  font-size: 12px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ak-badge--muted {
  background: rgba(60, 60, 67, 0.06);
  border-color: transparent;
  color: rgba(60, 60, 67, 0.78);
}
.ak-badge.cursor-pointer:hover {
  background: rgba(0, 122, 255, 0.12);
  border-color: rgba(0, 122, 255, 0.18);
}
.ak-badge.cursor-pointer:active {
  background: rgba(0, 122, 255, 0.16);
  border-color: rgba(0, 122, 255, 0.24);
}
.ak-badge--muted.cursor-pointer:hover {
  background: rgba(60, 60, 67, 0.10);
  border-color: rgba(60, 60, 67, 0.12);
}
.ak-badge--muted.cursor-pointer:active {
  background: rgba(60, 60, 67, 0.14);
  border-color: rgba(60, 60, 67, 0.16);
}

.ak-rank-cell {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
}
.ak-rank-cell .ak-badge {
  grid-column: 2;
  justify-self: center;
  font-variant-numeric: tabular-nums;
  background: transparent;
  border-color: transparent;
}
.ak-rank-cell .ak-badge:not(.ak-badge--muted) {
  color: var(--ak-primary);
}
.ak-row:hover .ak-rank-cell .ak-badge:not(.ak-badge--muted):not(:hover),
.ak-row:focus-within .ak-rank-cell .ak-badge:not(.ak-badge--muted):not(:hover) {
  background: rgba(0, 122, 255, 0.08);
  border-color: rgba(0, 122, 255, 0.14);
}
.ak-row:hover .ak-rank-cell .ak-badge.ak-badge--muted:not(:hover),
.ak-row:focus-within .ak-rank-cell .ak-badge.ak-badge--muted:not(:hover) {
  background: rgba(60, 60, 67, 0.06);
  border-color: rgba(60, 60, 67, 0.10);
}
.ak-rank-delta {
  grid-column: 3;
  justify-self: start;
  margin-left: 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ak-rank-delta.up {
  color: #16a34a;
}
.ak-rank-delta.down {
  color: #f43f5e;
}

.ak-inline-input {
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--ak-border);
  border-radius: 8px;
  font-size: 12px;
  background: #fff;
  color: var(--ak-text);
  outline: none;
}
.ak-inline-input:focus {
  border-color: rgba(0, 122, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}
.ak-inline-input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
.ak-inline-input[type="number"]::-webkit-outer-spin-button,
.ak-inline-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ak-aso-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}
.ak-aso-input {
  width: 64px;
}

.ak-detail-chart {
  height: 240px;
}

.ak-detail-chart canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.ak-menu {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 6px;
  min-width: 160px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(60, 60, 67, 0.14);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
  z-index: 30;
}

.ak-menu-item {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  color: rgba(15, 23, 42, 0.86);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ak-menu-item:hover {
  background: rgba(15, 23, 42, 0.04);
}

.ak-menu-item:active {
  background: rgba(15, 23, 42, 0.06);
}

.ak-menu-item.danger {
  color: #b91c1c;
}

.ak-menu-item.danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

.ak-history-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 32px;
}
.ak-history-spark-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ak-history-actions {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translate(6px, -50%);
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(60, 60, 67, 0.12);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.ak-row:hover .ak-history-actions,
.ak-row:focus-within .ak-history-actions {
  opacity: 1;
  pointer-events: auto;
}
.ak-history-actions .ak-btn.icon {
  width: 28px;
  height: 28px;
  font-size: 16px;
}

.ak-empty {
  text-align: center;
  padding: 20px;
  color: var(--ak-sub);
}

.star-icon {
  cursor: pointer;
  color: #d1d5db;
  font-size: 16px;
  transition: color 0.15s;
}
.star-icon.favorited {
  color: #ffb400;
}

.ak-spark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  overflow: hidden;
  max-width: 100%;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.ak-spark svg {
  cursor: default;
}

.ak-spark-tip {
  position: fixed;
  z-index: 10000;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(60, 60, 67, 0.12);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
  color: rgba(15, 23, 42, 0.92);
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
  pointer-events: none;
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
}

.ak-spark-placeholder {
  font-size: 12px;
  line-height: 1;
}

.ak-row:hover .ak-spark,
.ak-row:focus-within .ak-spark {
  background: rgba(60, 60, 67, 0.04);
  border-color: transparent;
}

.ak-spark.is-empty,
.ak-spark.is-loading {
  border-color: transparent;
  background: transparent;
  color: rgba(60, 60, 67, 0.60);
}

.ak-table td {
  height: 40px;
  vertical-align: middle;
}

.ak-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.ak-filter-chip {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ak-filter-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(107, 114, 128, 0.9);
  letter-spacing: 0.01em;
}
.ak-filter-row .ak-input,
.ak-filter-row .ak-select {
  background: #fff;
  border-color: var(--ak-border);
}
.ak-filter-row .ak-input:focus,
.ak-filter-row .ak-select:focus {
  border-color: rgba(0, 122, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

/* Modal (match page style) */
.ak-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(15, 23, 42, 0.30);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: akModalFadeIn 0.16s ease-out both;
}

/* Ensure nested modals (e.g. anomalies) can appear above other open modals. */
#chartAnomaliesModal {
  z-index: 60;
}

.ak-modal-panel {
  border-radius: 14px;
  border: 1px solid rgba(60, 60, 67, 0.14);
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  animation: akModalPop 0.18s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.ak-modal-panel.ak-card {
  border-radius: 14px;
  border-color: rgba(60, 60, 67, 0.14);
}

.ak-modal-panel .ak-title {
  font-size: 15px;
}

.ak-modal-divider {
  height: 1px;
  background: rgba(60, 60, 67, 0.08);
}

.ak-modal-panel .ak-modal-header {
  padding: 14px 16px 8px;
}

.ak-modal-panel .ak-modal-body {
  padding: 0 16px 14px;
}

.ak-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ak-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ak-field-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(107, 114, 128, 0.92);
  letter-spacing: 0.01em;
}

.ak-field-help {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(107, 114, 128, 0.75);
}

.ak-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(60, 60, 67, 0.12);
  background: rgba(60, 60, 67, 0.04);
  color: rgba(15, 23, 42, 0.82);
  font-size: 12px;
}

.ak-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.ak-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(15, 23, 42, 0.86);
  user-select: none;
}

.ak-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--ak-primary);
}

.ak-check input[type="checkbox"][disabled] {
  opacity: 0.5;
}

.ak-check input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.22);
  outline-offset: 2px;
  border-radius: 4px;
}

.ak-dropzone {
  padding: 16px;
  border-radius: 14px;
  border: 1px dashed rgba(60, 60, 67, 0.24);
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.ak-dropzone:hover {
  border-color: rgba(0, 122, 255, 0.38);
  background: rgba(0, 122, 255, 0.04);
}

.ak-hour-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
}

.km-block {
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(60, 60, 67, 0.12);
  background: #fff;
}

.km-block--primary {
  border-color: rgba(0, 122, 255, 0.18);
  background: rgba(0, 122, 255, 0.04);
}

.km-block .ak-field {
  gap: 6px;
}

.km-block .ak-field + .ak-field {
  margin-top: 10px;
}

.km-block .ak-section-head {
  margin-bottom: 10px;
}

.km-block + .km-block {
  margin-top: 14px;
}

.km-two-col {
  column-gap: 12px;
  row-gap: 10px;
  align-items: end;
}

.km-two-col .ak-field-label {
  white-space: nowrap;
}

@media (max-width: 520px) {
  .km-two-col .ak-field-label {
    white-space: normal;
  }
}

.ak-modal-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ak-modal-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(60, 60, 67, 0.08);
  background: rgba(60, 60, 67, 0.03);
  transition: background 0.15s, border-color 0.15s;
}

.ak-modal-list-row:hover {
  border-color: rgba(60, 60, 67, 0.12);
  background: rgba(60, 60, 67, 0.05);
}

.ak-rule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ak-rule-row {
  align-items: flex-start;
}

.ak-rule-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ak-rule-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ak-rule-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.92);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ak-rule-meta {
  font-size: 12px;
  color: rgba(107, 114, 128, 0.85);
  font-variant-numeric: tabular-nums;
}

.ak-rule-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.ak-rule-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.9);
}
.ak-rule-status.is-on {
  color: rgba(16, 185, 129, 0.95);
}
.ak-rule-status.is-on::before {
  background: rgba(16, 185, 129, 0.95);
}
.ak-rule-status.is-off {
  color: rgba(148, 163, 184, 0.95);
}
.ak-rule-status.is-off::before {
  background: rgba(148, 163, 184, 0.95);
}

.ak-rule-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: rgba(107, 114, 128, 0.92);
  line-height: 1.25;
}

.ak-rule-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(60, 60, 67, 0.04);
  border: 1px solid rgba(60, 60, 67, 0.08);
  max-width: 100%;
  min-width: 0;
}

.ak-rule-pill strong {
  color: rgba(60, 60, 67, 0.82);
  font-weight: 600;
}

.ak-rule-pill span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ak-rule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.ak-modal-panel .ak-modal-footer {
  padding: 0 16px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.ak-modal-panel .ak-modal-footer .ak-btn {
  height: 34px;
  padding: 0 14px;
  min-width: 96px;
}

.ak-modal-panel .ak-modal-footer .ak-btn.small {
  min-width: 88px;
}

@media (max-width: 520px) {
  .ak-modal-panel .ak-modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .ak-modal-panel .ak-modal-footer .ak-btn {
    width: 100%;
    min-width: 0;
  }
}

.ak-btn.icon {
  width: 32px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  color: #94a3b8;
}
.ak-btn.icon:hover {
  background: rgba(15, 23, 42, 0.04);
  border-color: transparent;
  color: #475569;
}
.ak-btn.icon:active {
  background: rgba(15, 23, 42, 0.06);
}

.ak-btn.icon.danger {
  color: rgba(220, 38, 38, 0.82);
}
.ak-btn.icon.danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: rgba(185, 28, 28, 0.98);
}
.ak-btn.icon.danger:active {
  background: rgba(220, 38, 38, 0.12);
}

.ak-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.ak-btn.is-loading {
  opacity: 0.82;
  pointer-events: none;
}

.ak-spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.22);
  border-top-color: rgba(15, 23, 42, 0.78);
  display: inline-block;
  flex: 0 0 auto;
  animation: akSpin 0.72s linear infinite;
}

.ak-btn.primary .ak-spinner {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 0.95);
}

@keyframes akSpin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

.ak-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.ak-btn.icon.ak-icon-btn {
  width: 26px;
  height: 26px;
  font-size: 16px;
}

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

@keyframes akModalPop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .ak-modal,
  .ak-modal-panel {
    animation: none;
  }
}

/* Toast (replace native alert) */
.ak-toast-host {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.ak-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: min(520px, calc(100vw - 28px));
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(60, 60, 67, 0.14);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 16px 50px rgba(15, 23, 42, 0.12);
  color: var(--ak-text);
  animation: akToastIn 0.18s ease-out both;
}

.ak-toast.is-leaving {
  animation: akToastOut 0.16s ease-in both;
}

.ak-toast-dot {
  margin-top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.28);
  flex: 0 0 auto;
}

.ak-toast-text {
  font-size: 13px;
  line-height: 1.35;
  color: rgba(15, 23, 42, 0.86);
  word-break: break-word;
}

.ak-toast.success {
  border-color: rgba(22, 163, 74, 0.22);
  background: rgba(240, 253, 244, 0.76);
}
.ak-toast.success .ak-toast-dot {
  background: rgba(22, 163, 74, 0.8);
}

.ak-toast.warn {
  border-color: rgba(245, 158, 11, 0.22);
  background: rgba(255, 251, 235, 0.82);
}
.ak-toast.warn .ak-toast-dot {
  background: rgba(245, 158, 11, 0.82);
}

.ak-toast.error {
  border-color: rgba(220, 38, 38, 0.22);
  background: rgba(254, 242, 242, 0.78);
}
.ak-toast.error .ak-toast-dot {
  background: rgba(220, 38, 38, 0.82);
}

@keyframes akToastIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes akToastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(6px) scale(0.98); }
}

/* Custom select (to replace native dropdown popup) */
.ak-selectbox {
  position: relative;
  width: 100%;
}

.ak-selectbox-native {
  display: none;
}

.ak-selectbox-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.ak-selectbox-trigger:focus-visible {
  outline: none;
}

.ak-selectbox-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ak-selectbox-chevron {
  flex: 0 0 auto;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1;
}

.ak-selectbox-menu {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid rgba(60, 60, 67, 0.14);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  padding: 6px;
  min-width: 160px;
  max-height: 320px;
  overflow: auto;
}

.ak-selectbox-menu.hidden {
  display: none;
}

.ak-selectbox-option {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  color: var(--ak-text);
  text-align: left;
}

.ak-selectbox-option:hover {
  background: #f1f5f9;
}

.ak-selectbox-option.is-selected {
  background: rgba(0, 122, 255, 0.08);
  color: #0b4aa2;
}

.ak-selectbox-check {
  color: rgba(0, 122, 255, 0.9);
  font-weight: 700;
}
.ak-btn.small {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.ak-divider {
  height: 1px;
  background: rgba(60, 60, 67, 0.12);
}

.ak-filter-section {
  padding: 12px;
}
.ak-filter-section + .ak-filter-section {
  margin-top: 10px;
  padding-top: 6px;
}

.ak-sf-row {
  margin-bottom: 8px;
}

.ak-sf-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ak-sf-selected-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(107, 114, 128, 0.95);
  user-select: none;
}
.ak-sf-selected-label {
  color: rgba(107, 114, 128, 0.9);
}
.ak-sf-selected-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(107, 114, 128, 0.95);
}
.ak-sf-selected-code {
  letter-spacing: 0.02em;
}
.ak-sf-selected-more {
  color: rgba(0, 122, 255, 0.85);
}

.ak-sf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--ak-border);
  background: #fff;
  color: var(--ak-text);
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  position: relative;
}
.ak-sf-chip:hover {
  background: #f9fafb;
  border-color: rgba(60, 60, 67, 0.18);
}
.ak-sf-chip.is-active {
  background: rgba(0, 122, 255, 0.08);
  border-color: rgba(0, 122, 255, 0.35);
  color: #0b4aa2;
}
.ak-sf-chip--manage {
  background: rgba(0, 122, 255, 0.06);
  border-color: rgba(0, 122, 255, 0.22);
  color: rgba(0, 122, 255, 0.95);
  padding: 0 12px;
}
.ak-sf-chip--clear {
  background: rgba(60, 60, 67, 0.04);
  border-color: rgba(60, 60, 67, 0.14);
  color: rgba(60, 60, 67, 0.78);
  padding: 0 12px;
}
.ak-sf-chip--clear:hover {
  background: rgba(60, 60, 67, 0.06);
  border-color: rgba(60, 60, 67, 0.18);
}

/* 拖拽排序样式 */
.ak-sf-chip[draggable="true"] {
  cursor: grab;
  user-select: none;
}
.ak-sf-chip[draggable="true"]:active {
  cursor: grabbing;
}
.ak-sf-chip.is-dragging {
  opacity: 0.5;
  background: rgba(0, 122, 255, 0.12);
  border-color: rgba(0, 122, 255, 0.4);
}
.ak-sf-chip.drag-over {
  background: rgba(0, 122, 255, 0.15);
  border-color: rgba(0, 122, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.ak-sf-flag {
  font-size: 14px;
  line-height: 1;
}
.ak-sf-code {
  letter-spacing: 0.02em;
}

.ak-warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(255, 59, 48, 0.46);
  color: rgba(255, 59, 48, 0.95);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.08);
  pointer-events: none;
  user-select: none;
}

.ak-sf-chip .ak-warn {
  position: absolute;
  top: -3px;
  right: -3px;
  transform: none;
}

.ak-sf-selected-item .ak-warn,
.ak-flag .ak-warn {
  width: 12px;
  height: 12px;
  font-size: 9px;
}

.ak-sf-result-code .ak-warn,
.ak-sf-modal-code .ak-warn {
  margin-left: 6px;
}

.ak-warn-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.ak-warn-btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ak-warn-btn:hover {
  background: rgba(15, 23, 42, 0.04);
  border-color: transparent;
}
.ak-warn-btn.is-active {
  background: rgba(255, 59, 48, 0.08);
  border-color: rgba(255, 59, 48, 0.28);
}
.ak-warn-btn.is-active:hover {
  background: rgba(255, 59, 48, 0.1);
  border-color: rgba(255, 59, 48, 0.35);
}
.ak-warn-btn:active {
  background: rgba(15, 23, 42, 0.06);
}
.ak-warn-btn:focus-visible {
  outline: 3px solid rgba(255, 59, 48, 0.22);
  outline-offset: 2px;
}

.ak-warn-btn .ak-warn {
  transform: translateY(-0.5px);
}

.ak-warn-popover {
  position: absolute;
  top: 28px;
  left: 0;
  z-index: 80;
  min-width: 260px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.ak-warn-anchor:hover .ak-warn-popover,
.ak-warn-anchor:focus-within .ak-warn-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.ak-warn-popover-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.92);
  margin-bottom: 8px;
}

.ak-warn-popover-list {
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: none; /* Firefox */
}
.ak-warn-popover-list::-webkit-scrollbar {
  display: none; /* Webkit */
}

.ak-warn-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(15, 23, 42, 0.84);
  line-height: 1.2;
}
.ak-warn-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ak-warn-item-code {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: rgba(107, 114, 128, 0.9);
}
.ak-warn-item-reason {
  color: rgba(107, 114, 128, 0.85);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ak-sf-warn-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 59, 48, 0.28);
  background: rgba(255, 59, 48, 0.03);
}
.ak-sf-warn-filter-text {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.75);
}

.ak-sf-modal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ak-sf-modal-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 36px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--ak-border);
  background: #fff;
  font-size: 12px;
  color: var(--ak-text);
  min-width: 0;
}
.ak-sf-modal-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ak-sf-modal-code {
  color: rgba(107, 114, 128, 0.9);
}
.ak-sf-remove {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(60, 60, 67, 0.16);
  background: #fff;
  color: rgba(107, 114, 128, 0.9);
  line-height: 1;
  cursor: pointer;
}
.ak-sf-remove:hover {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(60, 60, 67, 0.22);
}

.ak-sf-results {
  margin-top: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: none; /* Firefox */
}
.ak-sf-results::-webkit-scrollbar {
  display: none; /* Webkit */
}

.ak-sf-tip {
  font-size: 12px;
  color: rgba(107, 114, 128, 0.95);
  margin-bottom: 8px;
}

.ak-sf-section {
  margin-top: 14px;
}
.ak-sf-section:first-child {
  margin-top: 0;
}
.ak-sf-section-title {
  font-size: 12px;
  font-weight: 500;
  color: rgba(107, 114, 128, 0.95);
  margin-bottom: 8px;
}
.ak-sf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
@media (max-width: 720px) {
  .ak-sf-grid {
    grid-template-columns: 1fr;
  }
}
.ak-sf-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(60, 60, 67, 0.12);
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.ak-sf-result:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.ak-sf-result:disabled:hover {
  border-color: rgba(60, 60, 67, 0.12);
  background: #fff;
}
.ak-sf-result:hover {
  border-color: rgba(0, 122, 255, 0.25);
  background: rgba(0, 122, 255, 0.03);
}
.ak-sf-result-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ak-text);
  font-size: 12px;
}
.ak-sf-result-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(107, 114, 128, 0.95);
}
.ak-sf-result-add {
  font-size: 12px;
  color: rgba(0, 122, 255, 0.95);
}
.ak-sf-result-add.is-check {
  min-width: 18px;
  text-align: right;
  color: rgba(0, 122, 255, 0.95);
  font-weight: 600;
  line-height: 1;
}
.ak-sf-result-add.is-check:not(:empty) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.14);
}
.ak-sf-result-add.is-remove {
  color: rgba(220, 38, 38, 0.85);
}
.ak-sf-result-add.is-disabled {
  color: rgba(107, 114, 128, 0.95);
}

.ak-sf-result.is-selected {
  border-color: rgba(0, 122, 255, 0.35);
  background: rgba(0, 122, 255, 0.05);
}
.ak-sf-result.is-selected:hover {
  border-color: rgba(0, 122, 255, 0.45);
  background: rgba(0, 122, 255, 0.07);
}

.ak-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.ak-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}

.ak-section-sub {
  font-size: 12px;
  color: rgba(107, 114, 128, 0.95);
  margin-top: 2px;
}

.ak-section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ak-filter-row--main {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  overflow: visible;
}

.ak-filter-row--batch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  overflow: visible;
}

.ak-filter-row--main .ak-filter-chip,
.ak-filter-row--batch .ak-filter-chip {
  flex: 0 0 auto;
}

.ak-span-2 {
  grid-column: span 2;
}

.ak-input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--ak-border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.ak-input-group:focus-within {
  border-color: rgba(0, 122, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}
.ak-input-group .ak-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.ak-input-group textarea.ak-input {
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  padding: 7px 10px;
  line-height: 1.2;
  resize: none;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
}
.ak-input-group textarea.ak-input::-webkit-scrollbar {
  display: none; /* Webkit */
}
.ak-input-group .ak-btn {
  height: 32px;
  border: none;
  border-radius: 0;
  padding: 0 14px;
  margin: 0;
}
.ak-input-group .ak-btn.soft {
  border-left: 1px solid rgba(0, 122, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.ak-input-group .ak-btn.soft:hover {
  border-left-color: rgba(0, 122, 255, 0.45);
}
.ak-input-group .ak-btn.soft:active {
  border-left-color: rgba(0, 122, 255, 0.55);
}
.ak-input-group .ak-btn.primary {
  position: relative;
  background: linear-gradient(180deg, #0a84ff 0%, #007aff 55%, #006fe8 100%);
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: filter 0.15s ease, background 0.15s ease;
}
.ak-input-group .ak-btn.primary:hover {
  filter: brightness(1.03);
}
.ak-input-group .ak-btn.primary:active {
  filter: brightness(0.96);
}

.ak-input-group .ak-combo-prefix {
  flex: 0 0 160px;
  height: 32px;
  display: flex;
  align-items: center;
  background: #f8fafc;
}
.ak-input-group .ak-combo-prefix .rs-trigger {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  justify-content: flex-start;
  min-width: 0;
}
.ak-input-group .ak-combo-prefix .rs-trigger:focus {
  outline: none;
}
.ak-input-group .ak-combo-prefix .rs-trigger .flag {
  font-size: 16px;
}
.ak-input-group .ak-combo-prefix .rs-trigger .label,
.ak-input-group .ak-combo-prefix .rs-trigger .code-text {
  font-size: 12px;
  color: var(--ak-text);
  max-width: 110px;
}
.ak-input-group .ak-combo-prefix .rs-trigger .chevron {
  margin-left: auto;
  color: rgba(107, 114, 128, 0.9);
  font-size: 11px;
}

/* 批量输入组：更一致的苹果风分隔与圆角 */
.ak-batch-input-group {
  border-radius: 10px;
  border-color: rgba(60, 60, 67, 0.14);
}
.ak-batch-input-group .ak-combo-prefix {
  background: rgba(60, 60, 67, 0.04);
}
.ak-batch-input-group .ak-btn.soft {
  border-left: 1px solid rgba(60, 60, 67, 0.12);
}
.ak-batch-input-group:focus-within .ak-btn.soft {
  border-left-color: rgba(0, 122, 255, 0.22);
}

.ak-filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: 0;
}

.ak-batch-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: 0;
}

@media (max-width: 1280px) {
  .ak-filter-row--main,
  .ak-filter-row--batch {
    flex-wrap: wrap;
  }
}

/* 单排模式：为关键控件设定固定宽度，避免换行 */
#keywordSearchType { width: 92px; }
#keywordSearch { width: 180px; }
#keywordTypeFilter { width: 120px; }
#rankMin,
#rankMax,
#popularityMin,
#popularityMax,
#asoMin,
#asoMax { width: 104px; }

#batchStorefrontWrap { width: 160px; }
.ak-batch-input-group { width: 580px; }

.ak-page .ak-accent {
  color: var(--ak-primary);
}

.ak-page .ak-btn.text.ak-accent {
  color: var(--ak-primary);
}
.ak-page .ak-btn.text.ak-accent:hover {
  background: rgba(0, 122, 255, 0.08);
}

.ak-page .ak-btn.icon.ak-accent {
  color: var(--ak-primary);
}
.ak-page .ak-btn.icon.ak-accent:hover {
  background: rgba(0, 122, 255, 0.08);
  color: var(--ak-primary);
}
.ak-page .ak-btn.icon.ak-accent:active {
  background: rgba(0, 122, 255, 0.12);
}

.ak-page .ak-soft {
  background: rgba(0, 122, 255, 0.06);
  border: 1px solid rgba(0, 122, 255, 0.18);
}

.ak-page .ak-today {
  background: rgba(0, 122, 255, 0.06);
  border-color: rgba(0, 122, 255, 0.28);
}

.ak-page .ak-hour-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--ak-border);
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: #fff;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ak-page .ak-hour-btn:hover {
  background: #f8fafc;
}
.ak-page .ak-hour-btn.is-active {
  background: var(--ak-primary);
  border-color: var(--ak-primary);
  color: #fff;
}
.ak-input::placeholder,
.ak-input input::placeholder {
  color: rgba(107, 114, 128, 0.7);
}

textarea.ak-input {
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  padding: 7px 10px;
  line-height: 1.2;
  resize: none;
  overflow-y: auto;
}

/* ============================
   侧边栏布局样式
   ============================ */

/* 顶部固定栏（当前应用信息）- 跟随页面滚动，非固定 */
.ak-top-bar {
  position: sticky;
  top: var(--ak-topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--ak-border);
  height: 56px;
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0 0 12px;
  padding: 0 16px;
  z-index: 40;
}
/* 侧边栏收起时，顶部栏占满宽度 */
.ak-page.sidebar-collapsed .ak-top-bar {
  margin: 0 0 12px;
}
.ak-top-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  width: 100%;
}
.ak-sidebar-toggle-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--ak-border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.ak-sidebar-toggle-btn:hover {
  background: #f1f5f9;
  border-color: rgba(0, 122, 255, 0.35);
}
.ak-hamburger {
  font-size: 16px;
  color: #64748b;
}
.ak-top-bar-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}
.ak-top-bar-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ak-top-bar-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ak-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.ak-top-bar-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* 小号标签和按钮 */
.ak-tag--small {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
}
.ak-btn--small {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
}

/* 主内容包装器 */
.ak-main-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  min-height: calc(100vh - var(--ak-layout-top-offset) - var(--ak-secondary-bar-height)); /* 减去 topbar + 空白 和 ak-top-bar 高度 */
}
.ak-page.sidebar-collapsed .ak-main-wrapper {
  gap: 0;
}

/* 左侧侧边栏 */
.ak-sidebar {
  position: sticky;
  top: var(--ak-topbar-height);
  flex: 0 0 var(--ak-sidebar-width);
  width: var(--ak-sidebar-width);
  height: calc(100vh - var(--ak-topbar-height));
  max-height: calc(100vh - var(--ak-topbar-height));
  background: #fff;
  border-right: 1px solid var(--ak-border);
  display: flex;
  flex-direction: column;
  z-index: 30;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.ak-sidebar--open {
  transform: translateX(0);
  opacity: 1;
}
.ak-sidebar:not(.ak-sidebar--open) {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.ak-sidebar-header {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(60, 60, 67, 0.08);
  flex-shrink: 0;
}
.ak-sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ak-text);
}

.ak-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ak-sidebar-footer {
  padding: 10px;
  border-top: 1px solid rgba(60, 60, 67, 0.08);
  flex-shrink: 0;
}

.ak-btn--sidebar-collapse {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--ak-border);
  background: #fff;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.ak-btn--sidebar-collapse:hover {
  background: #f8fafc;
  border-color: rgba(60, 60, 67, 0.22);
}
.ak-collapse-icon {
  font-size: 10px;
  transition: transform 0.2s;
}

/* 侧边栏应用卡片（垂直布局） */
.ak-sidebar-app {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
}
.ak-sidebar-app:hover {
  background: rgba(60, 60, 67, 0.04);
}
.ak-sidebar-app.active {
  background: rgba(0, 122, 255, 0.08);
  border-color: rgba(0, 122, 255, 0.25);
}
.ak-sidebar-app-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}
.ak-sidebar-app-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ak-sidebar-app-name {
  font-size: 12px;
  color: var(--ak-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ak-sidebar-app-creator {
  font-size: 10px;
  color: var(--ak-sub, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 应用列表拖拽排序样式 */
.ak-sidebar-app[draggable="true"] {
  cursor: grab;
}
.ak-sidebar-app[draggable="true"]:active {
  cursor: grabbing;
}
.ak-sidebar-app.is-dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.ak-sidebar-app.drag-over {
  position: relative;
}
.ak-sidebar-app.drag-over::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--ak-primary, #007aff);
  border-radius: 1px;
}

/* 添加应用按钮（侧边栏内） */
.ak-sidebar-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
  border: 1px dashed rgba(60, 60, 67, 0.22);
  background: transparent;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 4px;
}
.ak-sidebar-add:hover {
  background: rgba(0, 122, 255, 0.04);
  border-color: rgba(0, 122, 255, 0.35);
  color: var(--ak-primary);
}

/* 右侧内容区 */
.ak-content-area {
  flex: 1;
  min-width: 0; /* 防止 flex 子元素溢出 */
  overflow: visible;
}
.ak-page.sidebar-collapsed .ak-content-area {
  margin-left: 16px;
}

/* 覆盖 ak-layout 在 ak-content-area 内的 margin */
.ak-content-area.ak-layout {
  margin: 0 0 18px 0;
  max-width: none;
  padding: 0 16px 18px 0;
}


/* 侧边栏收起时，内容区占满 */
.ak-page.sidebar-collapsed .ak-sidebar {
  position: absolute;
  left: 0;
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

/* 响应式：小屏幕时隐藏侧边栏 */
@media (max-width: 768px) {
  .ak-sidebar {
    position: fixed;
    top: var(--ak-topbar-height);
    left: 0;
    width: 240px;
    height: calc(100vh - var(--ak-topbar-height));
    max-height: none;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
  }
  .ak-content-area {
    margin-left: 0;
  }
  .ak-page:not(.sidebar-collapsed) .ak-content-area {
    margin-left: 0;
  }
  .ak-sidebar-toggle {
    display: flex;
  }
  /* 小屏幕侧边栏需要点击汉堡菜单才显示 */
  .ak-sidebar:not(.ak-sidebar--open) {
    transform: translateX(-100%);
  }
}

/* ============================
   总榜单图表布局优化
   ============================ */

/* 确保图表区域填满可用空间 */
.ak-overall-chart {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* 确保图表卡片正确布局 */
.ak-overall-card {
  overflow: visible;
  margin-top: 8px;
}

.ak-overall-body {
  padding-top: 0;
}

/* ============================
   z-index 优先级修复
   ============================ */

/* 确保 topbar 中的下拉菜单显示在其他固定元素之上 */
.topbar .user-dropdown,
.topbar .rs-dropdown,
.search-bar .rs-dropdown {
  z-index: 3000 !important;
}

/* 确保地区选择器下拉菜单在固定头部之上 */
body > .rs-dropdown {
  z-index: 9999 !important;
}

/* 确保 ak-top-bar 内的下拉菜单正确显示 */
.ak-top-bar .rs-dropdown {
  z-index: 100 !important;
}

/* ============================
   全球榜单排名面板样式
   ============================ */

.ak-global-ranks-panel {
  background: #fff;
  border: 1px solid rgba(60, 60, 67, 0.08);
  border-left: none;
  border-radius: 0 12px 12px 0;
  display: flex;
  flex-direction: column;
}

.ak-global-ranks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(60, 60, 67, 0.06);
  background: #fff;
  border-radius: 0 12px 0 0;
  flex-shrink: 0;
}

.ak-global-ranks-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}

.ak-global-ranks-select {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(100, 116, 139, 0.2);
  background: #fff;
  color: #334155;
  cursor: pointer;
}

.ak-global-ranks-select:hover {
  border-color: rgba(100, 116, 139, 0.35);
}

.ak-global-ranks-list {
  flex: 1;
  overflow-y: scroll;
  padding: 0;
  background: #fff;
  border-radius: 0 0 12px 0;
}

/* 滚动条始终可见 */
.ak-global-ranks-list::-webkit-scrollbar {
  width: 6px;
}

.ak-global-ranks-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 3px;
}

.ak-global-ranks-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.ak-global-ranks-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* 表格样式 */
.ak-grp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ak-grp-table thead {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.ak-grp-table th {
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  color: #64748b;
  font-size: 10px;
  border-bottom: 1px solid rgba(100, 116, 139, 0.12);
  white-space: nowrap;
}

.ak-grp-th-rank {
  width: 46px;
}

.ak-grp-th-count {
  width: 28px;
  text-align: center !important;
}

.ak-grp-th-countries {
  /* 自动填充剩余空间 */
}

/* 表格行 */
.ak-grp-row {
  border-bottom: 1px solid rgba(100, 116, 139, 0.08);
}

.ak-grp-row:last-child {
  border-bottom: none;
}

.ak-grp-row:hover {
  background: rgba(100, 116, 139, 0.03);
}

/* 表格单元格 */
.ak-grp-td-rank {
  padding: 8px 6px;
  vertical-align: middle;
  white-space: nowrap;
}

.ak-grp-td-count {
  padding: 8px 4px;
  text-align: center;
  font-weight: 600;
  color: #0f172a;
  vertical-align: middle;
  font-size: 11px;
}

.ak-grp-td-countries {
  padding: 6px 6px;
  vertical-align: middle;
}

/* 排名文本 */
.ak-grp-rank-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
}

/* 单个条目 */
.ak-grp-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: rgba(100, 116, 139, 0.06);
  border-radius: 4px;
  font-size: 10px;
  color: #334155;
  white-space: nowrap;
  margin: 2px 3px 2px 0;
}

.ak-grp-item:hover {
  background: rgba(100, 116, 139, 0.12);
}

/* 国旗 */
.ak-grp-flag {
  font-size: 11px;
  line-height: 1;
}

/* 国家名称 */
.ak-grp-name {
  color: #475569;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 排名 */
.ak-grp-rank {
  color: #94a3b8;
  font-size: 9px;
}

/* 加载/空/错误状态 */
.ak-grp-loading,
.ak-grp-empty,
.ak-grp-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
}

.ak-grp-error {
  color: #ef4444;
}

/* 响应式：小屏幕隐藏右侧面板 */
@media (max-width: 1200px) {
  .ak-global-ranks-panel {
    display: none;
  }
}

/* 总榜单网格布局调整 */
.ak-overall-grid {
  display: flex;
  gap: 0;
  align-items: stretch;
  width: 100%;
}

/* 左侧图表区域 - 占 65% */
.ak-overall-grid > .ak-overall-chart {
  flex: 65 0 0;
  min-width: 0;
}

/* 右侧全球榜单面板 - 占 35% */
.ak-overall-grid > .ak-global-ranks-panel {
  flex: 35 0 0;
  min-width: 280px;
  max-width: 450px;
  height: 320px;
}

/* ========== 自定义日期选择器样式 ========== */
.ak-overall-controls {
  position: relative;
}

.ak-date-picker-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1000;
  display: flex;
  background: #fff;
  border: 1px solid var(--ak-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.ak-date-picker-panel.hidden {
  display: none;
}

/* 左侧快捷选项 */
.ak-date-picker-shortcuts {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  border-right: 1px solid var(--ak-border);
  min-width: 100px;
}

.ak-date-picker-shortcut {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ak-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.ak-date-picker-shortcut:hover {
  background: rgba(0, 122, 255, 0.06);
}

.ak-date-picker-shortcut.is-active {
  background: rgba(0, 122, 255, 0.1);
  font-weight: 500;
}

/* 日历容器 */
.ak-date-picker-calendars {
  display: flex;
  padding: 12px;
  gap: 16px;
}

.ak-date-picker-calendar {
  width: 240px;
  min-height: 250px;
}

/* 日历头部 */
.ak-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 12px;
}

.ak-calendar-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ak-text);
}

.ak-calendar-nav {
  display: flex;
  gap: 4px;
}

.ak-calendar-nav-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ak-sub);
  cursor: pointer;
  border-radius: 4px;
  font-size: 12px;
}

.ak-calendar-nav-btn:hover {
  background: rgba(60, 60, 67, 0.08);
  color: var(--ak-text);
}

/* 日历网格 */
.ak-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: var(--ak-sub);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ak-border);
  margin-bottom: 8px;
}

.ak-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.ak-calendar-day {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--ak-text);
  cursor: pointer;
  border-radius: 6px;
  border: none;
  background: transparent;
  transition: background 0.15s, color 0.15s;
}

.ak-calendar-day:hover:not(.is-disabled):not(.is-empty) {
  background: rgba(0, 122, 255, 0.08);
}

.ak-calendar-day.is-empty {
  cursor: default;
}

.ak-calendar-day.is-other-month {
  color: rgba(60, 60, 67, 0.3);
}

.ak-calendar-day.is-disabled {
  color: rgba(60, 60, 67, 0.2);
  cursor: not-allowed;
}

.ak-calendar-day.is-today {
  font-weight: 600;
  color: var(--ak-primary);
}

.ak-calendar-day.is-selected {
  background: var(--ak-primary);
  color: #fff;
}

.ak-calendar-day.is-in-range {
  background: rgba(0, 122, 255, 0.12);
  border-radius: 0;
}

.ak-calendar-day.is-range-start {
  background: var(--ak-primary);
  color: #fff;
  border-radius: 6px 0 0 6px;
}

.ak-calendar-day.is-range-end {
  background: var(--ak-primary);
  color: #fff;
  border-radius: 0 6px 6px 0;
}

.ak-calendar-day.is-range-start.is-range-end {
  border-radius: 6px;
}

/* 自定义按钮日历图标 */
.ak-calendar-icon {
  margin-right: 4px;
  vertical-align: middle;
  opacity: 0.7;
}

#customDateBtn {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

#customDateBtn.is-active #customDateBtnText {
  color: var(--ak-primary);
}
