:root {
  --bg: #0b1020;
  --bg2: #111a2e;
  --panel: rgba(20, 30, 52, 0.85);
  --border: rgba(255, 255, 255, 0.10);
  --text: #e7eef8;
  --muted: #8fa1bd;
  --accent: #00e5ff;
  --accent2: #4dd0ff;
  --gold: #ffd166;
  --green: #35d08a;
  --red: #ff5d6c;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 50% -10%, #1b2b52 0%, transparent 60%),
    linear-gradient(160deg, #0d1428 0%, #0b1020 55%, #0a0d1c 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 12px 22px;
  font-size: 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, opacity .15s ease, box-shadow .2s ease;
  user-select: none;
  text-align: center;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); }
.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: .38;
  cursor: not-allowed;
  pointer-events: none;
}
.btn.primary {
  background: linear-gradient(135deg, #00b8d4, #0077ff);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0, 160, 255, .35);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 8px 30px rgba(0, 180, 255, .55); }
.btn.success {
  background: linear-gradient(135deg, #16b46c, #0e9d67);
  border-color: transparent;
  color: #fff;
}
.btn.gold {
  background: linear-gradient(135deg, #ffc83d, #ff9d2e);
  border-color: transparent;
  color: #33220a;
}
.btn.danger { background: linear-gradient(135deg, #ff5d6c, #e53b4c); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.big { padding: 16px 26px; font-size: 18px; border-radius: 14px; }
.btn.block { width: 100%; }

/* ---------- 輸入 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 7px; }
input[type="text"], input[type="password"], input[type="url"], input[type="color"], select, textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  font-size: 16px;
  border-radius: 11px;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}
select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238fa1bd' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
select option { background: #111a2e; color: var(--text); }
input[type="color"] { padding: 4px; height: 46px; cursor: pointer; }
input[type="file"] { color: var(--muted); font-size: 14px; }

/* ---------- 卡片 / 面板 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(8px);
}
.card h2, .card h3 { margin-bottom: 14px; font-weight: 600; }

.hint { font-size: 13px; color: var(--muted); line-height: 1.6; }
.tag {
  display: inline-block;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.tag.green { color: var(--green); border-color: rgba(53, 208, 138, .4); }
.tag.gold { color: var(--gold); border-color: rgba(255, 209, 102, .4); }
.tag.red { color: var(--red); border-color: rgba(255, 93, 108, .4); }
.tag.cyan { color: var(--accent); border-color: rgba(0, 229, 255, .4); }

/* ---------- 登錄 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box { width: 100%; max-width: 380px; }
.login-box .logo { text-align: center; margin-bottom: 22px; }
.login-box .logo h1 { font-size: 26px; letter-spacing: 1px; }

/* ---------- 頂欄 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.7);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}
.topbar .brand { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.topbar .brand small { color: var(--accent); }
.topbar .actions { display: flex; gap: 10px; align-items: center; }

.container { max-width: 1080px; margin: 0 auto; padding: 22px 18px 60px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-size: 13px; font-weight: 500; }
.table td { font-size: 15px; }
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.code-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(0, 229, 255, 0.10);
  color: var(--accent);
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions .btn { padding: 7px 12px; font-size: 13px; border-radius: 9px; }

/* ---------- 提示 / Toast ---------- */
#toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #16213a;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 999;
  max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: rgba(255, 93, 108, .6); }

/* ---------- 模態 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 16, 0.7);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
.modal-mask.open { display: flex; }
.modal {
  width: 100%;
  max-width: 560px;
  background: #121a2f;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-top: 6vh;
}
.modal h3 { margin-bottom: 16px; }
.modal .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.wrap { flex-wrap: wrap; }
