:root {
  --color-primary: #0284c7;
  --color-primary-2: #22d3ee;
  --color-on-primary: #042433;
  --color-secondary: #67e8f9;
  --color-accent: #06b6d4;
  --color-background: #061018;
  --color-foreground: #e8f7ff;
  --color-card: rgba(8, 32, 44, 0.78);
  --color-muted: rgba(10, 42, 56, 0.72);
  --color-muted-foreground: #9bb8c9;
  --color-border: rgba(34, 211, 238, 0.28);
  --color-destructive: #f43f5e;
  --color-on-destructive: #fff5f7;
  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-ring: #22d3ee;
  --shadow-glow: 0 0 0 1px rgba(34, 211, 238, 0.18), 0 18px 48px rgba(2, 12, 20, 0.55);
  --shadow-cta: 0 10px 28px rgba(8, 145, 178, 0.28), 0 0 28px rgba(34, 211, 238, 0.2);
  --radius: 18px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --font-display: "Orbitron", "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-body: "Exo 2", "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --z-nav: 20;
  --z-notice: 200;
  --z-modal: 80;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--color-foreground);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  background:
    radial-gradient(1200px 640px at 12% -10%, rgba(34, 211, 238, 0.22), transparent 55%),
    radial-gradient(900px 520px at 92% 0%, rgba(2, 132, 199, 0.32), transparent 50%),
    radial-gradient(700px 480px at 70% 110%, rgba(8, 145, 178, 0.16), transparent 46%),
    linear-gradient(165deg, #08202c 0%, #061018 46%, #040c12 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(2, 132, 199, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
}

body::after {
  content: "";
  position: fixed;
  width: 42vw;
  height: 42vw;
  max-width: 520px;
  max-height: 520px;
  right: -8vw;
  top: -8vw;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.28) 0%, rgba(2, 132, 199, 0.12) 42%, transparent 70%);
  filter: blur(8px);
  animation: orb-drift 16s ease-in-out infinite alternate;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 400;
  padding: 10px 14px;
  border-radius: 12px;
  background: #083344;
  color: #fff;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

.layout, .main, .sidebar, .panel, .shell { position: relative; z-index: 1; }

a { color: var(--color-secondary); }

button, .btn, .nav-btn, .tool-btn, .role-btn { cursor: pointer; touch-action: manipulation; }

button:disabled, .btn:disabled { opacity: 0.6; cursor: wait; }

:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.32);
}

.layout { display: flex; min-height: 100dvh; }

.sidebar {
  width: 248px;
  padding: 24px 14px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(8, 36, 48, 0.9), rgba(6, 18, 26, 0.92));
  border-right: 1px solid var(--color-border);
  box-shadow: 12px 0 40px rgba(2, 12, 20, 0.28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  background: linear-gradient(90deg, #e0f2fe 0%, #22d3ee 52%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub {
  color: var(--color-secondary);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.nav-btn {
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 14px;
  border: 1px solid rgba(34, 211, 238, 0.16);
  background: rgba(6, 22, 32, 0.55);
  color: #dff8ff;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.nav-btn:hover {
  border-color: rgba(34, 211, 238, 0.55);
  background: rgba(34, 211, 238, 0.1);
  transform: translateX(2px);
}
.nav-btn.active {
  background: linear-gradient(90deg, rgba(8, 145, 178, 0.42), rgba(34, 211, 238, 0.16));
  border-color: rgba(103, 232, 249, 0.7);
  box-shadow: 0 0 0 1px rgba(8, 145, 178, 0.28), 0 10px 24px rgba(2, 132, 199, 0.22);
}

.main { flex: 1; padding: 22px; }

.hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
  padding: 22px 24px;
  border-radius: 24px;
  border: 1px solid var(--color-border);
  background:
    linear-gradient(135deg, rgba(8, 145, 178, 0.28), rgba(2, 132, 199, 0.14) 48%, rgba(8, 28, 40, 0.72)),
    rgba(8, 24, 34, 0.78);
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.hero h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.03em;
}
.hero p { margin: 0; color: var(--color-muted-foreground); max-width: 62ch; }

.hero-user { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }

.hero-identity {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(8, 145, 178, 0.16);
  border: 1px solid rgba(34, 211, 238, 0.4);
  color: #e0f7ff;
  font-size: 13px;
}

.section { display: none; }
.section.active { display: block; animation: rise-in 320ms ease; }

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }

.card {
  grid-column: span 12;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }

.title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.title h2 { margin: 0; font-size: 20px; font-family: var(--font-display); letter-spacing: 0.03em; }
.title small { color: var(--color-muted-foreground); }

.metric { display: grid; gap: 8px; position: relative; }
.metric span { color: var(--color-muted-foreground); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.metric strong {
  font-size: 36px;
  font-family: var(--font-display);
  background: linear-gradient(90deg, #67e8f9, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.span-4.card { overflow: hidden; }
.span-4.card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-2));
}
.span-4.card { position: relative; }

.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.field { grid-column: span 4; display: flex; flex-direction: column; gap: 8px; }
.field.half { grid-column: span 6; }
.field.full { grid-column: span 12; }
.field.price { grid-column: span 3; }

label { color: #cffafe; font-size: 14px; font-weight: 600; }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(34, 211, 238, 0.24);
  outline: none;
  background: rgba(4, 16, 24, 0.78);
  color: var(--color-foreground);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  color-scheme: dark;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
option { background: #083344; color: #e8f7ff; }
textarea { min-height: 120px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #7aa0b0; }
input:focus, select:focus, textarea:focus {
  border-color: var(--color-primary-2);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16);
}

.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

.tips { color: var(--color-muted-foreground); font-size: 13px; line-height: 1.8; padding-top: 8px; }

.btn {
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  min-height: 44px;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-on-primary);
  transition: transform 160ms ease, box-shadow 180ms ease, filter 180ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-green {
  background: linear-gradient(135deg, #67e8f9 0%, #22d3ee 42%, #0284c7 100%);
  box-shadow: var(--shadow-cta);
}
.btn-blue {
  background: linear-gradient(135deg, #a5f3fc, #0284c7);
  color: #042433;
}
.btn-red {
  background: linear-gradient(135deg, #fb7185, #e11d48);
  color: var(--color-on-destructive);
}
.btn-gray {
  background: rgba(10, 42, 56, 0.9);
  color: #e0f7ff;
  border: 1px solid rgba(34, 211, 238, 0.28);
}

table { width: 100%; border-collapse: collapse; overflow: hidden; border-radius: 14px; }
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(8, 145, 178, 0.16);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}
th {
  color: #cffafe;
  background: rgba(8, 145, 178, 0.28);
  font-weight: 700;
  white-space: nowrap;
}
td { color: #e8f7ff; }
td .empty { padding: 16px 0; }

.status {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.status-unused { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
.status-active { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; }
.status-expired { background: rgba(251, 191, 36, 0.16); color: #fde68a; }
.status-banned { background: rgba(244, 63, 94, 0.16); color: #fda4af; }

.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 32px;
  font-size: 12px;
  font-weight: 700;
  transition: filter 160ms ease, transform 160ms ease;
}
.tool-btn:hover { filter: brightness(1.12); }
.tool-blue { background: #163b63; color: #7dd3fc; }
.tool-gray { background: #14323e; color: #cffafe; }
.tool-red { background: #4c1230; color: #fda4af; }
.tool-green { background: #0f3d45; color: #5eead4; }
.tool-yellow { background: #3f2d12; color: #fde68a; }

.notice {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: rgba(6, 18, 26, 0.92);
  color: var(--color-foreground);
  margin-bottom: 16px;
  display: none;
  white-space: pre-wrap;
}
.notice.show {
  display: block;
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-notice);
  min-width: 280px;
  max-width: min(640px, 90vw);
  box-shadow: var(--shadow-glow);
}
.notice.success { border-color: rgba(52, 211, 153, 0.55); color: #d1fae5; background: #10241f; }
.notice.error { border-color: rgba(244, 63, 94, 0.55); color: #ffe4e6; background: #2a1018; }

.help-box {
  background: rgba(6, 22, 32, 0.78);
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 16px;
  padding: 18px;
  line-height: 1.9;
  color: #d7f6ff;
}
.help-box h3 { margin: 0 0 12px; color: #67e8f9; }
.help-box pre {
  margin: 14px 0 0;
  background: #041018;
  border: 1px solid rgba(34, 211, 238, 0.18);
  padding: 14px;
  border-radius: 12px;
  overflow: auto;
  color: #a5f3fc;
}

.empty { color: var(--color-muted-foreground); padding: 16px 0; }

.nav-btn[hidden], [hidden] { display: none !important; }
.agent-balance { margin-bottom: 16px; }

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(2, 10, 16, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.modal-card {
  width: 100%;
  max-width: 460px;
  background: rgba(8, 32, 44, 0.96);
  border: 1px solid var(--color-border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow-glow), 0 0 80px rgba(34, 211, 238, 0.16);
}
.modal-card.price-modal { max-width: 780px; }
.modal-card h2 { margin: 0 0 8px; font-size: 22px; font-family: var(--font-display); }
.modal-card .modal-sub { color: var(--color-muted-foreground); margin-bottom: 16px; font-size: 14px; }

.feed-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(8, 145, 178, 0.16);
}
.feed-item:last-child { border-bottom: none; }
.feed-meta { color: var(--color-muted-foreground); font-size: 13px; margin-top: 4px; }

.page-login, .page-unbind {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.panel, .login-panel {
  width: 100%;
  max-width: 440px;
  padding: 30px;
  border-radius: 24px;
  background: rgba(8, 28, 40, 0.86);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-glow), 0 0 80px rgba(34, 211, 238, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.page-login .brand { font-size: 32px; margin-bottom: 8px; }
.page-login .tips { margin-bottom: 16px; }
.page-login .field { margin-bottom: 14px; }
.page-login .btn { width: 100%; font-size: 15px; }

.role-row { display: flex; gap: 10px; margin-bottom: 18px; }
.role-btn {
  flex: 1;
  min-height: 44px;
  border: 1px solid rgba(34, 211, 238, 0.24);
  background: rgba(4, 16, 24, 0.78);
  color: #cffafe;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
}
.role-btn.active {
  border-color: var(--color-primary-2);
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.36), rgba(34, 211, 238, 0.16));
  color: #fff;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.2);
}

.msg {
  display: none;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(244, 63, 94, 0.55);
  background: #2a1018;
  color: #ffe4e6;
  white-space: pre-wrap;
}
.msg.show { display: block; }

.page-unbind .shell { width: 100%; max-width: 520px; }
.page-unbind .intro { margin: 0 0 22px; color: var(--color-muted-foreground); }
.page-unbind h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 28px;
}
.page-unbind .btn { width: 100%; }
.page-unbind .hint { margin-top: 7px; color: #7aa0b0; font-size: 12px; line-height: 1.6; }
.page-unbind .notice.show {
  position: static;
  transform: none;
  left: auto;
  top: auto;
  min-width: 0;
  max-width: none;
  margin-bottom: 18px;
}
.safe-box {
  display: grid;
  gap: 9px;
  margin-top: 22px;
  padding: 15px 16px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 15px;
  background: rgba(6, 22, 32, 0.78);
  color: #d7f6ff;
  font-size: 13px;
  line-height: 1.7;
}
.safe-box strong { color: var(--color-primary-2); }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes orb-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-40px, 28px, 0) scale(1.08); }
}

@media (max-width: 1200px) {
  .span-4, .span-6, .field, .field.half, .field.price { grid-column: span 12; }
  .layout { display: block; }
  .sidebar { width: auto; height: auto; position: static; }
  .hero-user { align-items: flex-start; }
  .hero h1 { font-size: 24px; }
}

@media (max-width: 768px) {
  .main { padding: 14px; }
  .hero, .card, .panel, .login-panel { padding: 18px; border-radius: 18px; }
  .btn-row .btn { flex: 1 1 140px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
  .section.active { animation: none; }
}

/* ===== 响应式布局 / 防止页面撑破 ===== */
html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

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

.layout,
.sidebar,
.main,
.hero,
.hero > *,
.grid,
.card,
.form-grid,
.field,
.title,
.feed-item,
.help-box,
.modal-card,
.panel,
.shell,
.role-row,
.table-scroll {
  min-width: 0;
  max-width: 100%;
}

.layout {
  width: 100%;
  max-width: 100vw;
}

.main {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  overflow-x: hidden;
}

.grid,
.form-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.card,
.panel,
.help-box,
.feed-item,
.notice,
.modal-card,
.hero-identity,
.safe-box,
.msg {
  overflow-wrap: anywhere;
  word-break: break-word;
}

input,
select,
textarea,
button,
.btn,
.role-btn,
.nav-btn {
  min-width: 0;
  max-width: 100%;
}

pre,
code {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 表格只允许在自己的容器中横向滑动，不能把整个页面撑宽。 */
.table-scroll,
#create-result,
#home-cards,
#home-logs {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}

.table-scroll table,
#create-result table,
#home-cards table,
#home-logs table {
  width: 100%;
  min-width: 720px;
  max-width: none;
}

th,
td {
  max-width: 420px;
}

td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 登录页单独约束：任何宽度下都不得超过视口。 */
.page-login,
.page-unbind {
  width: 100%;
  min-width: 0;
  min-height: 100svh;
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  overflow-x: hidden;
}

.page-login .login-panel,
.page-unbind .shell {
  width: min(100%, 440px);
  min-width: 0;
  margin-inline: auto;
}

.page-unbind .shell { width: min(100%, 520px); }

.page-login .login-panel {
  padding: clamp(18px, 5vw, 30px);
}

.page-login .field {
  width: 100%;
  min-width: 0;
  grid-column: 1 / -1;
}

.page-login input {
  width: 100%;
  min-width: 0;
}

.page-login .brand {
  font-size: clamp(24px, 7vw, 32px);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.role-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}

.role-btn {
  width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* 平板 */
@media (max-width: 1200px) and (min-width: 769px) {
  .main { width: 100%; }
  .span-4 { grid-column: span 6; }
  .span-6 { grid-column: span 12; }
  .field { grid-column: span 6; }
  .field.half { grid-column: span 6; }
  .field.price { grid-column: span 4; }
  .field.full { grid-column: span 12; }
}

/* 手机/窄屏：导航改为顶部横向滑动，不再占满一整屏高度。 */
@media (max-width: 768px) {
  body { background-attachment: scroll; }

  .layout { display: block; }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: var(--z-nav);
    width: 100%;
    height: auto;
    max-height: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left));
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 10px 30px rgba(2, 12, 20, 0.35);
  }

  .sidebar .brand {
    flex: 0 0 auto;
    margin: 0 6px 0 0;
    font-size: 18px;
    white-space: nowrap;
  }

  .sidebar .sub { display: none; }

  .nav-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    min-height: 40px;
    margin: 0;
    padding: 9px 12px;
    text-align: center;
    white-space: nowrap;
  }

  .nav-btn:hover { transform: none; }

  .main {
    width: 100%;
    padding: 12px;
  }

  .hero {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
  }

  .hero h1 { font-size: clamp(20px, 6vw, 25px); }
  .hero-user { width: 100%; align-items: stretch; }
  .hero-user .btn { width: 100%; }
  .hero-identity { width: 100%; border-radius: 14px; }

  .grid,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .span-4,
  .span-6,
  .field,
  .field.half,
  .field.price,
  .field.full {
    grid-column: 1 / -1;
  }

  .card,
  .panel,
  .login-panel {
    width: 100%;
    padding: 16px;
    border-radius: 18px;
  }

  .title {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .title h2 { font-size: 18px; }

  .btn-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .btn-row .btn {
    width: 100%;
    min-width: 0;
  }

  .tools { gap: 6px; }
  .tool-btn { min-height: 36px; padding: 8px 10px; }

  .table-scroll table,
  #create-result table,
  #home-cards table,
  #home-logs table {
    min-width: 680px;
  }

  th, td {
    padding: 9px 8px;
    font-size: 13px;
  }

  .notice.show {
    top: max(10px, env(safe-area-inset-top));
    width: calc(100vw - 24px);
    min-width: 0;
    max-width: calc(100vw - 24px);
  }

  .modal-mask {
    align-items: flex-start;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: calc(100svh - 20px);
    margin: 0;
    padding: 16px;
    overflow-y: auto;
  }
}

@media (max-width: 480px) {
  .main { padding: 8px; }

  .hero,
  .card,
  .panel,
  .login-panel {
    padding: 14px;
    border-radius: 16px;
  }

  .page-login,
  .page-unbind {
    align-items: center;
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .role-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .btn-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .btn,
  .role-btn {
    min-height: 46px;
  }

  .metric strong { font-size: 30px; }
  .page-login .tips { line-height: 1.65; }
  .page-login .sub { letter-spacing: 0.12em; }

  input,
  select,
  textarea {
    font-size: 16px;
  }
}

@media (max-width: 360px) {
  .page-login .login-panel,
  .card,
  .hero { padding: 12px; }
  .page-login .brand { font-size: 23px; }
  .sidebar .brand { display: none; }
}

/* ===== Cloudflare Turnstile / 自助解绑响应式 ===== */
.turnstile-area {
  width: 100%;
  min-width: 0;
  margin: 4px 0 16px;
}
.turnstile-label {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #d7f6ff;
}
.turnstile-widget {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.turnstile-widget > div,
.turnstile-widget iframe {
  max-width: 100% !important;
}
.page-unbind form,
.page-unbind .field,
.page-unbind input,
.page-unbind button {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 480px) {
  .page-unbind { padding: 12px; align-items: flex-start; }
  .page-unbind .shell { width: 100%; max-width: 100%; }
  .page-unbind .panel { padding: 16px; border-radius: 16px; }
  .page-unbind h1 { font-size: 23px; }
  .page-unbind .intro { font-size: 14px; line-height: 1.65; }
  .turnstile-area { overflow-x: hidden; }
}
