/* ============================================================
 * base.css — reset + 排版 + 通用工具类
 * ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Helvetica Neue", "Microsoft YaHei", Roboto, sans-serif;
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6, p, figure, ul, ol, dl { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; border: 0; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font: inherit; color: inherit;
  border: 0; background: none; outline: none;
}
button { cursor: pointer; }

/* 隐藏滚动条但保留滚动 */
::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- 工具类 ---------- */
.u-hide { display: none !important; }
.u-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.u-flex { display: flex; }
.u-center { display: flex; align-items: center; justify-content: center; }
.u-between { display: flex; align-items: center; justify-content: space-between; }

/* 页面容器：底部统一留出导航高度 */
.page {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
}

/* ============================================================
 * RTL 适配 — 阿拉伯语等从右到左语言
 * 当 <html dir="rtl"> 时生效
 * ============================================================ */
[dir="rtl"] {
  /* 翻转方向性 SVG 图标：顶部导航返回按钮、列表右侧箭头 */
  .appbar__btn svg,
  .rows__arrow {
    transform: scaleX(-1);
  }

  /* 修正写死的左侧定位为右侧定位（镜像） */
  .field__eye {
    right: auto;
    left: 10px;
  }

  .auth__kf {
    right: auto;
    left: max(var(--sp-4), env(safe-area-inset-left, 0px));
  }

  /* 顶部栏内容从右对齐改为左对齐（镜像布局） */
  .auth__top {
    justify-content: flex-start;
  }

  /* 余额卡右上角的“+充值”按钮：RTL 下镜像到左上角，
     否则会压住从右侧开始的余额文字 */
  .balance__act {
    right: auto;
    left: var(--sp-4);
  }
}
