/* ============== NavHub · Apple 风格通用样式 ============== */
:root {
  /* Apple 设计语言配色 */
  --bg:           #f5f5f7;   /* 苹果浅灰底 */
  --bg-elev:      #ffffff;   /* 卡片纯白 */
  --bg-hover:     rgba(0,0,0,0.025);
  --text:         #1d1d1f;   /* 近黑 */
  --text-soft:    #6e6e73;   /* 次级灰 */
  --text-mute:    #86868b;
  --border:       #d2d2d7;   /* 苹果边框灰 */
  --border-soft:  rgba(0,0,0,0.08);
  --primary:      #0071e3;   /* 苹果蓝 */
  --primary-deep: #0058b9;
  --primary-soft: #e8f1fd;
  --danger:       #e0245e;
  --danger-soft:  #fde8ef;
  --success:      #34c759;
  --warn:         #ff9f0a;
  --radius:       16px;
  --radius-sm:    11px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 2px 6px rgba(0,0,0,0.04);
  --shadow:    0 8px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.18);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "PingFang SC", "Helvetica Neue", "Microsoft YaHei", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
button { font-family: inherit; }

/* ============== topbar（苹果导航栏：半透明白磨砂 + 极细底线） ============== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  user-select: none;
}
.brand-mark { font-size: 21px; }
.brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand-sub { color: var(--text-soft); font-size: 13px; }

.topbar-tools { display: flex; align-items: center; gap: 12px; }

/* 苹果风搜索框：浅灰底，focus 蓝边 + 柔和蓝晕 */
.search {
  width: 300px;
  max-width: 48vw;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.12);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.search::placeholder { color: var(--text-mute); }
.search:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.08);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s, color .2s, transform .2s;
  cursor: pointer;
  font-family: inherit;
}
.admin-link:hover { background: rgba(0, 113, 227, 0.1); color: var(--primary); }

.admin-link-big {
  height: 36px;
  padding: 0 16px 0 14px;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.admin-link-big:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 113, 227, 0.25);
}
.admin-link-big .admin-link-icon { font-size: 17px; line-height: 1; }
.admin-link-big .admin-link-text { letter-spacing: 0.3px; }

.admin-link-logout { color: var(--danger); }
.admin-link-logout:hover { background: var(--danger); color: #fff; }

/* ============== info-bar：时间 / 定位 / 天气（浅磨砂胶囊） ============== */
.info-bar {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  height: 34px;
  background: rgba(118, 118, 128, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 999px;
  color: var(--text);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  user-select: none;
  max-width: 50vw;
  overflow: hidden;
  white-space: nowrap;
}
.info-item { display: inline-flex; align-items: center; gap: 4px; }
.info-time { color: var(--text); font-weight: 600; }
.info-time .info-weekday { color: var(--text-soft); font-weight: 400; margin-left: 4px; font-size: 11.5px; }
.info-loc, .info-wth { color: var(--text-soft); }
.info-loc #info-city, .info-wth #info-weather { color: var(--text); font-weight: 500; }
.info-sep {
  display: inline-block;
  width: 1px;
  height: 12px;
  background: rgba(0, 0, 0, 0.12);
}
.info-bar .info-wth[title] { cursor: help; }
@media (max-width: 900px) {
  .info-bar { display: none; }
}

/* ============== container ============== */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px 24px 100px;
}
.loading { color: var(--text-soft); text-align: center; padding: 60px 0; }

.demo-banner {
  background: rgba(255, 159, 10, 0.12);
  color: #9a5b00;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 159, 10, 0.3);
  font-size: 13px;
  margin-bottom: 22px;
  text-align: center;
}
.demo-banner b { color: #7a4700; }

/* ============== ticker（汇率条：苹果浅色磨砂，与整体统一） ============== */
.ticker {
  display: flex;
  align-items: center;
  height: 36px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--text);
  font-size: 12px;
  overflow: hidden;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}
.ticker-label {
  flex: 0 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  letter-spacing: 1px;
  font-size: 12px;
  position: relative;
}
.ticker-label::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 0;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-left: 6px solid var(--primary);
}
.ticker-viewport {
  flex: 1 1 auto;
  overflow: hidden;
  height: 100%;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.ticker-track {
  display: inline-flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  will-change: transform;
  animation: ticker-scroll 32s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  height: 100%;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
}
.ticker-item .cur {
  font-weight: 700;
  color: var(--text);
  letter-spacing: .3px;
}
.ticker-item .val {
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.ticker-item .unit { color: var(--text-mute); font-size: 11px; }
.ticker-item .arrow { font-size: 9px; margin-left: 2px; line-height: 1; }
.ticker-sub {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  margin-left: 6px;
  padding-left: 8px;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 11px;
  color: var(--text-soft);
}
.ticker-sub .sub-tag { color: var(--primary); font-weight: 700; font-size: 10px; }
.ticker-sub .sub-val { color: var(--text); font-variant-numeric: tabular-nums; }
.ticker-sub .sub-unit { color: var(--text-mute); font-size: 10px; }
.ticker-sub-base { color: var(--text-mute); font-size: 11px; white-space: nowrap; }
/* 涨跌色：苹果红 / 苹果绿（国内惯例涨红跌绿） */
.chg-up   { color: #ff3b30; }
.chg-down { color: #34c759; }
.ticker-updated {
  flex: 0 0 auto;
  padding: 0 12px;
  color: var(--text-mute);
  font-size: 11px;
  white-space: nowrap;
}
.ticker-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  margin: 0 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  overflow: hidden;
  height: 22px;
}
.ticker-toggle button {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 11px;
  padding: 0 10px;
  cursor: pointer;
  line-height: 22px;
  transition: background .15s, color .15s;
}
.ticker-toggle button + button { border-left: 1px solid rgba(0, 0, 0, 0.1); }
.ticker-toggle button:hover { color: var(--text); }
.ticker-toggle button.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.ticker[data-mode="cn"] .ticker-sub { display: none; }
.ticker[data-mode="hk"] .ticker-item > .val,
.ticker[data-mode="hk"] .ticker-item > .unit,
.ticker[data-mode="hk"] .ticker-item > .arrow { display: none; }
.ticker[data-mode="hk"] .ticker-sub {
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
}
.ticker[data-mode="hk"] .ticker-sub .sub-tag { display: none; }
.ticker[data-mode="hk"] .ticker-sub .sub-val {
  color: var(--primary);
  font-weight: 600;
  font-size: 12px;
}
.ticker[data-mode="hk"] .ticker-sub .sub-unit { font-size: 11px; }
.ticker[data-mode="hk"] .ticker-sub-base { color: var(--text-mute); font-size: 11px; font-weight: 400; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ============== front: groups + items（Safari 标签卡：大图标 + 下方标题） ============== */
.group { margin-bottom: 40px; }
.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.group-icon { font-size: 19px; }
.group-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.group-count {
  color: var(--text-mute);
  font-size: 12px;
  background: rgba(118, 118, 128, 0.12);
  padding: 1px 8px;
  border-radius: 999px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 22px 18px;
}

.item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  padding: 8px 2px 4px;
  border-radius: 18px;
  transition: background .2s, transform .2s;
  position: relative;
}
.item:hover { background: var(--bg-hover); }
.item:hover .item-icon {
  transform: translateY(-4px) scale(1.06);
  box-shadow: var(--shadow);
  border-color: rgba(0, 113, 227, 0.4);
}
.item:hover .item-title { color: var(--primary); }

.item-icon {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #fafafc 100%);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s, border-color .22s;
}
.item-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
}
.item-icon .card-icon-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
}

.item-title {
  margin-top: 11px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 400;
  color: var(--text);
  width: 100%;
  max-width: 116px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  transition: color .18s;
}

.empty-group {
  grid-column: 1 / -1;
  color: var(--text-mute);
  text-align: center;
  padding: 24px;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.empty-all {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-soft);
}

mark {
  background: rgba(255, 214, 10, 0.4);
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

/* ============== footer ============== */
.footer {
  text-align: center;
  color: var(--text-mute);
  font-size: 12px;
  padding: 24px 16px 36px;
}
.footer a { color: var(--text-soft); }
.footer a:hover { color: var(--primary); }

/* ============== admin ============== */
.page-admin .container { padding-top: 26px; }
.panel {
  background: var(--bg-elev);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head h2 {
  font-size: 16px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.panel-head-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.search-input {
  width: 280px;
  max-width: 38vw;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.12);
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.search-input::placeholder { color: var(--text-mute); }
.search-input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}
.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: linear-gradient(45deg, transparent 45%, #86868b 45%, #86868b 55%, transparent 55%),
              linear-gradient(-45deg, transparent 45%, #86868b 45%, #86868b 55%, transparent 55%);
  cursor: pointer;
}
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.12);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  font-variant-numeric: tabular-nums;
}
.count-pill.count-active {
  background: var(--primary-soft);
  color: var(--primary);
}

@media (max-width: 720px) {
  .panel-head-tools { flex-wrap: wrap; }
  .search-input { width: 200px; }
}

.group-list { list-style: none; margin: 0; padding: 0; }
.group-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.group-list li:hover { background: rgba(0, 0, 0, 0.025); }
.group-list .g-icon { font-size: 18px; }
.group-list .g-name { flex: 1; font-weight: 500; }
.group-list .g-sort { color: var(--text-mute); font-size: 12px; }
.group-list .g-actions { display: flex; gap: 6px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th, .data-table td {
  padding: 11px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  vertical-align: middle;
}
.data-table th {
  color: var(--text-soft);
  font-weight: 500;
  background: rgba(0, 0, 0, 0.02);
  position: sticky;
  top: 0;
}
.data-table tr:hover td { background: rgba(0, 0, 0, 0.02); }
.data-table .ti { width: 40px; height: 40px; border-radius: 10px; background: rgba(118, 118, 128, 0.08); border: 1px solid rgba(0, 0, 0, 0.05); display:flex; align-items:center; justify-content:center; overflow:hidden; }
.data-table .ti img { width:100%; height:100%; object-fit:contain; }
.ti-fallback { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:16px; font-weight:700; color:#fff; }
.data-table .url { color: var(--text-soft); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.data-table .pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.pill-on  { background: rgba(52, 199, 89, 0.16); color: #1d7a36; }
.pill-off { background: rgba(118, 118, 128, 0.14); color: #6e6e73; }

/* ============== buttons ============== */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s, transform .12s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
}
.btn.primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); color: #fff; }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); background: #fff; }
.btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.small { padding: 5px 11px; font-size: 12px; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 16px;
  padding: 5px 9px;
  border-radius: 8px;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.05); color: var(--text); }

/* ============== modal ============== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-card {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text); }

.form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--text-soft); }
.field input, .field select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #fff;
  color: var(--text);
  transition: border-color .18s, box-shadow .18s;
}
.field input:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}
.form-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px;
}

/* ============== responsive ============== */
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .container { padding: 22px 16px 70px; }
  .search { width: 170px; }
  .brand-sub { display: none; }
  .admin-link-big .admin-link-text { display: none; }
  .admin-link-big { padding: 0 12px; }
  .data-table th:nth-child(4),
  .data-table td:nth-child(4),
  .data-table th:nth-child(5),
  .data-table td:nth-child(5) { display: none; }
}
