/* ============================================================
   Design Tokens — Intel Exchange Theme
   与 Ardot variable set「Intel Exchange Theme」一致，三端共用
   ============================================================ */
:root {
  /* canvas & surfaces */
  --canvas: #080A0A;
  --surface: #0F1214;
  --surface-elevated: #171A1F;
  --hairline: #212629;

  /* accents */
  --accent-cyan: #00E5FF;
  --accent-magenta: #FF3D99;

  /* text */
  --text-primary: #E8EBF0;
  --text-secondary: #91A6A8;
  --text-tertiary: #617073;

  /* states */
  --success: #00E599;
  --warning: #FFB021;
  --danger: #FF3B5C;

  /* price movement（中国市场惯例：涨红跌绿） */
  --price-up: #FF4D4D;
  --price-down: #12B88C;

  /* radius */
  --radius-card: 12px;
  --radius-pill: 36px;

  /* fonts */
  --font-sans: "Inter", "Sarasa Gothic SC", -apple-system, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --font-cn: "Sarasa Gothic SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  /* semantic aliases */
  --cyan: var(--accent-cyan);
  --text: var(--text-primary);
  --text-2: var(--text-secondary);
  --text-3: var(--text-tertiary);
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: #050708;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; background: none; border: none; outline: none; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, p { margin: 0; }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   排版工具
   ============================================================ */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num  { font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums; }

.text-cyan    { color: var(--cyan); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-dim     { color: var(--text-2); }
.text-dimmer  { color: var(--text-3); }

.stack  { display: flex; flex-direction: column; }
.row    { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-1 { flex: 1; min-width: 0; }
.right  { margin-left: auto; }
.divider { height: 1px; background: var(--hairline); }

/* ============================================================
   卡片
   ============================================================ */
.card {
  padding: 14px;
  background: var(--surface-elevated);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
}
.card--accent {
  background: rgba(0, 229, 255, 0.06);
  border-color: rgba(0, 229, 255, 0.35);
}
.card__title {
  margin: 0 0 10px;
  font-family: var(--font-cn);
  font-size: 13px;
  font-weight: 700;
}
.card__note { margin: 0; color: var(--text-3); font-size: 10px; line-height: 1.55; }
.card__label { color: var(--text-2); font-size: 10px; }

/* ============================================================
   键值行
   ============================================================ */
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 12px;
  color: var(--text-2);
}
.kv-row > :last-child { color: var(--text); font-family: var(--font-mono); font-size: 11px; text-align: right; }

/* ============================================================
   Chips 分段
   ============================================================ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 30px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.chip--on { background: var(--cyan); border-color: var(--cyan); color: #04141a; font-weight: 700; }

/* ============================================================
   Pill 徽标
   ============================================================ */
.pill {
  display: inline-grid;
  place-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.pill--cyan  { background: rgba(0, 229, 255, 0.12);  color: var(--cyan); }
.pill--green { background: rgba(0, 229, 233, 0.12);  color: var(--success); }
.pill--amber { background: rgba(255, 176, 33, 0.12);  color: var(--warning); }
.pill--red   { background: rgba(255, 59, 92, 0.12);   color: var(--danger); }
.pill--gray  { background: rgba(255, 255, 255, 0.07); color: var(--text-3); }

/* 密级标签 */
.tag {
  display: inline-grid;
  place-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.tag--s { background: rgba(255, 59, 92, 0.16);  color: var(--danger); }
.tag--a { background: rgba(255, 176, 33, 0.16); color: var(--warning); }
.tag--b { background: rgba(0, 229, 255, 0.16);  color: var(--cyan); }
.tag--p { background: rgba(255, 255, 255, 0.08); color: var(--text-2); }

/* ============================================================
   Toggle 开关 46×26，旋钮 20
   ============================================================ */
.toggle {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 26px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  cursor: pointer;
  transition: background .18s;
}
.toggle--on { background: var(--cyan); }
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: left .18s;
}
.toggle--on::after { left: 23px; }

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: grid;
  place-items: center;
  width: 100%;
  height: 48px;
  background: var(--cyan);
  border-radius: 12px;
  color: #04141a;
  font-family: var(--font-cn);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s;
}
.btn:active { filter: brightness(0.92); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--pill  { height: 50px; border-radius: 25px; }
.btn--sm    { height: 38px; font-size: 13px; border-radius: 10px; }
.btn--ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
  color: var(--text-2);
  font-weight: 400;
}
.btn--danger { background: var(--danger); color: #fff; }
.btn--warn   { background: var(--warning); color: #241800; }

/* ============================================================
   表单
   ============================================================ */
.field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  border-radius: 10px;
  transition: border-color .15s;
}
.field:focus-within { border-color: rgba(0, 229, 255, 0.4); }
.field input, .field textarea, .field select {
  flex: 1;
  width: 100%;
  font-size: 13px;
  resize: none;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field textarea { min-height: 72px; line-height: 1.6; }
.field select { cursor: pointer; }
.field select option { background: var(--surface-elevated); }

.switch-row, .switch-item { display: flex; align-items: center; gap: 12px; }
.switch-item { padding: 10px 0; border-bottom: 1px solid rgba(33, 38, 41, .6); }
.switch-item:last-child { border-bottom: none; }
.switch-item__txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.switch-item__txt b { font-size: 13px; font-weight: 600; }
.switch-item__txt span { font-size: 10px; color: var(--text-3); }

/* ============================================================
   进度条
   ============================================================ */
.progress { height: 4px; background: rgba(255, 255, 255, 0.07); border-radius: 2px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--cyan); border-radius: 2px; transition: width .3s; }

/* ============================================================
   头像
   ============================================================ */
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: rgba(0, 229, 255, 0.16);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar-lg { width: 52px; height: 52px; font-size: 19px; }
.avatar__img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.profile__bio { margin: 2px 0 10px; font-size: 11px; line-height: 1.5; color: var(--text-2);
  background: rgba(0, 229, 255, 0.05); border: 1px solid rgba(0, 229, 255, 0.14);
  border-radius: 10px; padding: 8px 10px; }

/* ============================================================
   版本更新弹窗
   ============================================================ */
.upd-mask { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center;
  justify-content: center; background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px);
  padding: 28px; animation: updIn 0.18s ease; }
@keyframes updIn { from { opacity: 0; } to { opacity: 1; } }
.upd { width: 100%; max-width: 300px; background: var(--bg-1, #101415);
  border: 1px solid rgba(0, 229, 255, 0.28); border-radius: 16px; padding: 20px 18px 16px;
  text-align: center; box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5); }
.upd__tag { display: inline-block; font-size: 10px; letter-spacing: 1px; color: #00e5ff;
  background: rgba(0, 229, 255, 0.12); border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 999px; padding: 3px 10px; margin-bottom: 10px; }
.upd__ver { font-size: 20px; font-weight: 700; color: var(--text-1, #e8f0f1); margin-bottom: 8px; }
.upd__note { font-size: 11px; line-height: 1.7; color: var(--text-2, #9aa8aa);
  max-height: 148px; overflow-y: auto; text-align: left; margin-bottom: 14px; }
.upd__acts { display: flex; gap: 8px; }
.upd__btn { flex: 1; height: 38px; border-radius: 10px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; background: #00e5ff; color: #04191c; }
.upd__btn--ghost { background: transparent; border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-2, #9aa8aa); }

/* ============================================================
   线路列表（服务器设置页）
   ============================================================ */
.ep-row { display: flex; align-items: center; gap: 8px; padding: 10px 0;
  border-bottom: 1px solid var(--hairline, rgba(255, 255, 255, 0.07)); font-size: 12px; }
.ep-row:last-child { border-bottom: none; }
.ep-row__dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: #4a5a5c; }
.ep-row__dot--ok { background: #34d399; box-shadow: 0 0 6px rgba(52, 211, 153, 0.6); }
.ep-row__dot--bad { background: #f87171; }
.ep-row__name { flex: 1; min-width: 0; }
.ep-row__url { display: block; font-size: 10px; color: var(--text-3, #6b7a7c);
  word-break: break-all; margin-top: 2px; }
.ep-row__ms { font-size: 11px; font-variant-numeric: tabular-nums; flex: 0 0 auto; }

/* ============================================================
   提示框
   ============================================================ */
.locked-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(0, 229, 255, 0.05);
  border: 1px solid rgba(0, 229, 255, 0.22);
  border-radius: 10px;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.55;
}
.notice-box {
  padding: 11px;
  background: rgba(255, 176, 33, 0.08);
  border: 1px solid rgba(255, 176, 33, 0.3);
  border-radius: 9px;
  color: #C9A96A;
  font-size: 11px;
  line-height: 1.55;
}
.notice-box--cyan { background: rgba(0, 229, 255, 0.06); border-color: rgba(0, 229, 255, 0.3); color: var(--cyan); }
.notice-box--red  { background: rgba(255, 59, 92, 0.07);  border-color: rgba(255, 59, 92, 0.3);  color: var(--danger); }

/* ============================================================
   上传框
   ============================================================ */
.upload-box {
  display: grid;
  place-items: center;
  min-height: 72px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--hairline);
  border-radius: 10px;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload-box:hover { border-color: rgba(0, 229, 255, .4); background: rgba(0, 229, 255, .04); }

/* ============================================================
   网格与菜单
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; }

.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 44px;
  font-size: 13px;
  border-bottom: 1px solid rgba(33, 38, 41, .55);
  cursor: pointer;
}
.menu-row:last-child { border-bottom: none; }
.menu-row__chev { color: var(--text-3); font-family: var(--font-mono); font-size: 16px; }

/* ============================================================
   Toast / Loading / Empty
   ============================================================ */
.toast-wrap {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding-top: 60px; pointer-events: none;
}
.toast {
  max-width: 84vw;
  padding: 10px 18px;
  background: rgba(23, 26, 31, .97);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  animation: toastIn .22s ease;
}
.toast--ok   { border-color: rgba(0, 229, 233, .45); color: var(--success); }
.toast--err  { border-color: rgba(255, 59, 92, .45);  color: var(--danger); }
.toast--warn { border-color: rgba(255, 176, 33, .45); color: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.loading { display: grid; place-items: center; gap: 10px; padding: 40px 0; color: var(--text-3); font-size: 12px; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--hairline); border-top-color: var(--cyan); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { display: grid; place-items: center; gap: 8px; padding: 40px 20px; color: var(--text-3); font-size: 12px; text-align: center; }
.empty__icon { font-size: 28px; opacity: .5; }

.skeleton { background: linear-gradient(90deg, rgba(255,255,255,.03) 25%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.03) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============================================================
   RTL 镜像（阿拉伯语 / 波斯语）
   ============================================================ */
[dir="rtl"] .navbar__back { transform: scaleX(-1); }
[dir="rtl"] .menu-row__chev { transform: scaleX(-1); display: inline-block; }
[dir="rtl"] .progress > span { margin-left: auto; }