/* ============================================================
   XI Link · iOS Design System
   ============================================================ */
:root {
  --bg: #f5f5f7;
  --card: rgba(255, 255, 255, 0.78);
  --card-solid: #ffffff;
  --primary: #0071e3;
  --primary-soft: #e8f2fd;
  --primary-grad: linear-gradient(135deg, #0071e3, #30d0c0);
  --text: #1d1d1f;
  --text-2: #86868b;
  --separator: rgba(0, 0, 0, 0.06);
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --purple: #af52de;
  --teal: #30d0c0;
  --yellow: #ffcc00;
  --island: #000;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.06);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Helvetica Neue", "Hiragino Sans GB", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-weight: 400;
  color: var(--text);
  background:
    radial-gradient(600px 400px at 12% -5%, rgba(0, 113, 227, 0.10), transparent 60%),
    radial-gradient(500px 380px at 92% 8%, rgba(175, 82, 222, 0.10), transparent 60%),
    radial-gradient(600px 420px at 50% 108%, rgba(48, 208, 192, 0.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.16); border-radius: 3px; }
::selection { background: rgba(0, 113, 227, 0.2); }

.app {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 118px) 16px calc(var(--safe-bottom) + 110px);
}
.app.wide { max-width: 1080px; }

h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; }
p { line-height: 1.55; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; font-size: 16px; font-weight: 500;
  transition: transform 0.18s var(--spring), filter 0.18s var(--ease), opacity 0.2s;
  user-select: none; white-space: nowrap; line-height: 1;
}
.btn:active { transform: scale(1.02); filter: brightness(1.08); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(0, 113, 227, 0.35); }
.btn-secondary { background: #e5e5ea; color: var(--text); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-lg { padding: 15px 28px; font-size: 17px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--separator);
  transition: transform 0.18s var(--spring), background 0.2s;
}
.icon-btn:active { transform: scale(0.92); background: var(--primary-soft); }

/* ---------------- inputs ---------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 8px; }
.input, .select, textarea.input {
  width: 100%; padding: 13px 16px; font-size: 16px; color: var(--text);
  background: rgba(118, 118, 128, 0.10);
  border: 1.5px solid transparent; border-radius: var(--r-sm);
  outline: none; font-family: inherit;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}
.input:focus, .select:focus, textarea.input:focus {
  background: #fff; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; padding-right: 42px; }
input[type="range"] { -webkit-appearance: none; width: 100%; height: 6px; border-radius: 3px; background: rgba(0,0,0,0.10); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 0.5px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2); cursor: pointer;
}
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; background: #e5e5ea;
  transition: background 0.25s var(--ease); cursor: pointer;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 28px; height: 28px;
  border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  transition: transform 0.25s var(--spring);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(20px); }

/* ---------------- cards ---------------- */
.card {
  background: var(--card); border-radius: var(--r-lg);
  border: 0.5px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  padding: 20px; margin-bottom: 16px;
}
.card-solid { background: var(--card-solid); }
.card-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.bento { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.bento .card { margin-bottom: 0; }
.bento .span2 { grid-column: span 2; }

.stat-num { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; }
.stat-label { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--primary-soft); color: var(--primary);
}
.badge-green { background: rgba(52, 199, 89, 0.12); color: var(--green); }
.badge-red { background: rgba(255, 59, 48, 0.12); color: var(--red); }
.badge-orange { background: rgba(255, 149, 0, 0.12); color: var(--orange); }
.badge-purple { background: rgba(175, 82, 222, 0.12); color: var(--purple); }
.badge-gray { background: rgba(134, 134, 139, 0.14); color: var(--text-2); }

/* ---------------- top header ---------------- */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 4px 14px;
}
.page-title { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; }
.page-sub { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  background: var(--primary-soft); display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: var(--shadow-soft); flex: none; color: var(--primary);
}

/* ---------------- tab bar ---------------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: flex; justify-content: space-around; align-items: center;
  max-width: 680px; margin: 0 auto;
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: rgba(245, 245, 247, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 0.5px solid var(--separator);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 14px; border-radius: 14px; color: var(--text-2);
  transition: transform 0.18s var(--spring), color 0.2s;
  min-width: 56px;
}
.tab:active { transform: scale(0.9); }
.tab svg { transition: transform 0.25s var(--spring); }
.tab.active { color: var(--primary); }
.tab.active svg { transform: translateY(-1px) scale(1.06); }
.tab .tab-label { font-size: 10px; font-weight: 500; }

/* ---------------- dynamic island ---------------- */
.island-wrap { position: fixed; top: calc(var(--safe-top) + 12px); left: 0; right: 0; z-index: 200; display: flex; justify-content: center; pointer-events: none; }
.island {
  pointer-events: auto; background: var(--island); color: #fff;
  border-radius: 40px; overflow: hidden; position: relative;
  transition: width 0.5s var(--spring), height 0.5s var(--spring), border-radius 0.5s var(--spring);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.island .island-inner { display: flex; align-items: center; justify-content: center; height: 100%; }
.island.small { width: 128px; height: 38px; }
.island.welcome { width: 320px; height: 88px; border-radius: 36px; }
.island.menu { width: min(94vw, 440px); height: 174px; border-radius: 36px; }

.island-time { font-size: 13px; font-weight: 600; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.island-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 8px; animation: pulse 1.6s infinite; }

.island-welcome { text-align: center; }
.island-welcome .t { font-size: 20px; font-weight: 700; letter-spacing: 0.4px; }
.island-welcome .s { font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 4px; }

.island-menu { padding: 16px 24px 18px; }
.island-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.island-brand { flex: 1; min-width: 0; }
.island-brand .n { font-size: 17px; font-weight: 700; letter-spacing: 0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.island-brand .s { font-size: 11px; color: rgba(255,255,255,0.55); display: flex; align-items: center; gap: 6px; }
.island-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.12); padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.island-actions { display: flex; justify-content: space-around; gap: 6px; padding: 0 4px; }
.island-act { display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.island-act .ic {
  width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.10); transition: background 0.2s, transform 0.18s var(--spring);
}
.island-act .ic:hover { background: rgba(255,255,255,0.2); }
.island-act .ic:active { transform: scale(0.88); }
.island-act .l { font-size: 10px; color: rgba(255,255,255,0.7); font-weight: 500; }
.island-tip {
  position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%) scale(0.8);
  background: #1c1c1e; color: #fff; font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: 10px; white-space: nowrap; opacity: 0;
  transition: opacity 0.2s, transform 0.2s var(--spring); pointer-events: none;
}
.island-tip::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #1c1c1e; }
.island-act .island-tip.show { opacity: 1; transform: translateX(-50%) scale(1); }

/* ---------------- sections ---------------- */
.section { animation: fadeIn 0.35s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

/* package grid */
.pkg-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pkg-card {
  position: relative; text-align: left; padding: 18px; border-radius: var(--r-lg);
  background: var(--card); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid transparent; box-shadow: var(--shadow);
  transition: transform 0.18s var(--spring), border-color 0.2s, box-shadow 0.2s;
}
.pkg-card:active { transform: scale(1.02); }
.pkg-card.selected { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(0,113,227,0.12), var(--shadow); }
.pkg-ic {
  width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); margin-bottom: 12px;
}
.pkg-name { font-size: 16px; font-weight: 700; }
.pkg-desc { font-size: 12px; color: var(--text-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pkg-avail { position: absolute; top: 14px; right: 14px; }

/* tips box */
.tips-box {
  background: rgba(255, 149, 0, 0.08); border: 1px solid rgba(255, 149, 0, 0.22);
  border-radius: var(--r-md); padding: 14px 16px;
}
.tips-box .tip-row { display: flex; gap: 8px; font-size: 13px; color: #8a5b00; padding: 3px 0; align-items: flex-start; }
.tips-box .tip-row svg { flex: none; margin-top: 2px; }

/* ---------------- chat ---------------- */
.chat-box {
  height: calc(100vh - 330px); min-height: 380px; display: flex; flex-direction: column;
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); overflow: hidden;
}
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 0.5px solid var(--separator); }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 10px; animation: msgIn 0.3s var(--spring); }
.msg .m-avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.msg .bubble { max-width: 78%; background: #fff; border-radius: 18px; padding: 10px 14px; font-size: 14px; line-height: 1.5; box-shadow: var(--shadow-soft); }
.msg .m-name { font-size: 11px; color: var(--text-2); margin: 0 4px 4px; }
.msg .m-time { font-size: 10px; color: rgba(134,134,139,0.7); margin-top: 3px; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
.msg.mine .m-name { text-align: right; }
.msg.bot .bubble { background: rgba(48, 208, 192, 0.1); color: #116b5e; }
.msg.warn .bubble { background: rgba(255, 59, 48, 0.08); color: var(--red); font-size: 12px; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
.chat-input { display: flex; gap: 10px; padding: 12px; border-top: 0.5px solid var(--separator); background: rgba(255,255,255,0.6); }
.chat-input .input { flex: 1; background: rgba(118,118,128,0.10); }
.chat-input .send { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; transition: transform 0.18s var(--spring); }
.chat-input .send:active { transform: scale(0.9); }

/* ---------------- music ---------------- */
.music-search { position: relative; }
.music-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-2); }
.music-search .input { padding-left: 44px; }
.song-row {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md);
  cursor: pointer; transition: background 0.15s;
}
.song-row:hover { background: rgba(0,0,0,0.04); }
.song-pic { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: #e5e5ea; flex: none; }
.song-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.player {
  position: fixed; bottom: calc(86px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  width: min(92vw, 640px); z-index: 50; background: var(--card);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: 20px; box-shadow: var(--shadow); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  border: 0.5px solid rgba(255,255,255,0.7);
  transition: transform 0.35s var(--spring), opacity 0.3s;
}
.player.collapsed { transform: translateX(-50%) translateY(120%); opacity: 0; pointer-events: none; }
.player-cover { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; background: var(--primary-soft); flex: none; }
.player-info { flex: 1; min-width: 0; }
.player-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-ctrl { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 4px 14px rgba(0,113,227,0.4); transition: transform 0.18s var(--spring); }
.player-ctrl:active { transform: scale(0.9); }

/* ---------------- lists ---------------- */
.list { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 0.5px solid var(--separator); }
.list-row:last-child { border-bottom: none; }
.list-row:active { background: rgba(0,0,0,0.03); }
.list-row .row-main { flex: 1; min-width: 0; }
.list-row .row-title { font-size: 15px; font-weight: 500; }
.list-row .row-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.list-ic { width: 38px; height: 38px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }

/* ---------------- profile ---------------- */
.profile-head {
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 20px;
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.profile-head .avatar { width: 84px; height: 84px; border-width: 3px; }
.profile-head .nick { font-size: 22px; font-weight: 700; margin-top: 12px; }
.profile-head .uname { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.meta-chip { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 4px 12px; border-radius: 999px; margin-top: 12px; }
.levels { display: flex; justify-content: space-around; margin-top: 20px; }
.level-item { flex: 1; text-align: center; }
.level-item .v { font-size: 20px; font-weight: 700; }
.level-item .k { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat-cell { background: var(--card); border-radius: var(--r-md); padding: 14px; text-align: center; box-shadow: var(--shadow-soft); }

/* ---------------- auth ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 20px; animation: fadeIn 0.3s var(--ease);
}
.sheet {
  width: min(420px, 100%); max-height: 92vh; overflow-y: auto;
  background: rgba(245,245,247,0.92); backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-radius: 28px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,0.3);
  animation: sheetIn 0.4s var(--spring);
}
@keyframes sheetIn { from { opacity: 0; transform: translateY(40px) scale(0.97); } to { opacity: 1; transform: none; } }
.sheet .logo {
  width: 68px; height: 68px; border-radius: 20px; background: var(--island); color: #fff;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.sheet h2 { text-align: center; font-size: 24px; margin-bottom: 6px; }
.sheet .sub { text-align: center; color: var(--text-2); font-size: 13px; margin-bottom: 24px; }
.auth-switch { text-align: center; font-size: 14px; color: var(--text-2); margin-top: 16px; }
.auth-switch a { font-weight: 500; }

/* ---------------- admin ---------------- */
.admin-wrap { position: fixed; inset: 0; z-index: 250; background: var(--bg); display: flex; flex-direction: column; animation: fadeIn 0.3s; }
.admin-top {
  display: flex; align-items: center; gap: 12px; padding: calc(var(--safe-top) + 12px) 16px 12px;
  border-bottom: 0.5px solid var(--separator); background: rgba(245,245,247,0.8);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); z-index: 2;
}
.admin-body { flex: 1; display: flex; overflow: hidden; }
.admin-side {
  width: 250px; flex: none; overflow-y: auto; padding: 12px; border-right: 0.5px solid var(--separator);
  background: var(--card);
}
.admin-side .group { margin-bottom: 6px; }
.admin-side .group-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px;
  font-size: 14px; font-weight: 500; color: var(--text); transition: background 0.15s;
}
.admin-side .group-head:hover { background: rgba(0,0,0,0.04); }
.admin-side .group-head .chev { margin-left: auto; transition: transform 0.25s var(--ease); color: var(--text-2); }
.admin-side .group.open .chev { transform: rotate(180deg); }
.admin-side .group-body { max-height: 0; overflow: hidden; transition: max-height 0.35s var(--ease); }
.admin-side .group.open .group-body { max-height: 400px; }
.admin-side .sub {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px 9px 40px; border-radius: 10px;
  font-size: 13px; color: var(--text-2); margin-top: 2px; transition: background 0.15s, color 0.15s;
}
.admin-side .sub:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.admin-side .sub.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.admin-main { flex: 1; overflow-y: auto; padding: 20px; }
.admin-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.admin-sub { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }
.admin-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-toolbar .input { width: auto; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: var(--r-md); padding: 16px; box-shadow: var(--shadow-soft); backdrop-filter: blur(16px); }
.stat-card .ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.stat-card .v { font-size: 24px; font-weight: 700; }
.stat-card .k { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-soft); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
.tbl th { text-align: left; padding: 12px 14px; font-size: 12px; font-weight: 500; color: var(--text-2); border-bottom: 0.5px solid var(--separator); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 0.5px solid var(--separator); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(0,0,0,0.02); }
.tbl .cell-main { font-weight: 500; }
.tbl .cell-sub { font-size: 12px; color: var(--text-2); }
.tbl .url-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- modal ---------------- */
.modal-mask { position: fixed; inset: 0; z-index: 320; background: rgba(0,0,0,0.35); backdrop-filter: blur(10px); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn 0.25s; }
.modal-card {
  width: min(480px, 100%); background: var(--card-solid); border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(24px + var(--safe-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
  max-height: 84vh; overflow-y: auto; animation: sheetUp 0.35s var(--spring);
}
@keyframes sheetUp { from { transform: translateY(60px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 18px; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; top: calc(var(--safe-top) + 66px); left: 50%; transform: translateX(-50%) translateY(-16px);
  z-index: 400; background: rgba(28,28,30,0.92); color: #fff; font-size: 14px; font-weight: 500;
  padding: 12px 22px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s var(--spring);
  display: flex; align-items: center; gap: 8px; max-width: 86vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(255, 59, 48, 0.92); }
.toast.ok { background: rgba(52, 199, 89, 0.95); }

/* ---------------- misc ---------------- */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.divider { height: 0.5px; background: var(--separator); margin: 16px 0; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); font-size: 14px; }
.empty svg { opacity: 0.4; margin-bottom: 10px; }
.skeleton { border-radius: 12px; background: linear-gradient(90deg, rgba(0,0,0,0.05), rgba(0,0,0,0.09), rgba(0,0,0,0.05)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-size: 13px; font-weight: 500; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }

/* ---------------- responsive ---------------- */
@media (max-width: 720px) {
  .admin-side { position: absolute; left: 0; top: 0; bottom: 0; z-index: 5; width: 260px; box-shadow: var(--shadow); transform: translateX(-100%); transition: transform 0.3s var(--ease); }
  .admin-side.open { transform: none; }
  .admin-main { padding: 14px; }
  .pkg-grid { grid-template-columns: 1fr; }
  .bento { grid-template-columns: 1fr; }
  .bento .span2 { grid-column: span 1; }
  .admin-title { font-size: 20px; }
}
