/* ===== Reset & base ===== */
:root { --max-w: 1200px; --pad: 16px; }
* { box-sizing: border-box; }
html, body, #root, #app { min-height: 100%; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 允许纵向滚动；不强制隐藏任何溢出，避免“看不全/无法滚动” */
  overflow-x: hidden;  /* 仅隐藏横向滚动条，避免误触 */
  overflow-y: auto;
}

img, canvas, video { max-width: 100%; height: auto; display: block; }

/* ===== Page container ===== */
.container { max-width: var(--max-w); margin-inline: auto; padding-inline: var(--pad); }

/* ===== Top bar ===== */
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; }
.topbar h1, .topbar h2, .topbar h3 { margin: 0; font-size: clamp(18px, 2.5vw, 22px); }

/* ===== Cards ===== */
.card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

/* ===== Forms ===== */
.form-row { display: flex; flex-wrap: wrap; gap: 12px; }
.form-row > * { flex: 1 1 220px; min-width: 0; }

input[type="text"], input[type="number"], input[type="search"], input[type="password"],
select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

button {
  height: 40px;
  padding: 0 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  cursor: pointer;
}
button.ghost { background: #fff; color: #111827; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== Auth/Login: 通用选择器，尽量匹配常见登录容器，保证竖屏可见 ===== */
.auth, .login, .page-login, [data-auth], [data-page="login"] {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth .card, .login .card, .page-login .card, [data-auth] .card, [data-page="login"] .card {
  width: min(480px, 100%);
  margin: 0 auto;
}

/* ===== Tables (desktop) ===== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

/* ===== Tables (mobile ≤ 768px): 卡片化，无需横向滚动 ===== */
@media (max-width: 768px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr {
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 12px;
    background: #fff;
  }
  .table td { border: none; padding: 6px 0; }
  .table td::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
  }
}

/* ===== Generic grid ===== */
.grid { display: grid; gap: 16px; }
@media (min-width: 768px) {
  .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
