/* ws-inbox 收包管理后台 —— 深色半透明玻璃风格 */
:root {
  /* 深黑棕玻璃层（深色轻透：透明 58%~72%，即不透明 alpha 0.28~0.42） */
  --glass: rgba(22, 17, 13, 0.30);
  --glass-strong: rgba(15, 12, 9, 0.40);
  --glass-soft: rgba(28, 22, 17, 0.28);
  --glass-solid: rgba(18, 14, 11, 0.40);

  --border: rgba(255, 178, 100, 0.12);
  --border-strong: rgba(255, 178, 100, 0.22);

  --text: #ffffff;
  --text-secondary: #e8e3da;
  --text-muted: #c2baac;

  --accent: #f97316;
  --accent2: #fb923c;
  --accent-soft: rgba(249, 115, 22, 0.16);
  --accent-glow: rgba(249, 115, 22, 0.35);

  --success: #4ade80;
  --danger: #f87171;
  --warning: #fbbf24;
  --info: #60a5fa;

  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --safe-zone: 18vh;

  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Courier New", monospace;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: #0c0a08;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------------- 背景图（全页清晰可见） ---------------- */
.starry-sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-layer {
  position: absolute; inset: 0;
  background: url('bg.jpg') center / cover no-repeat;
}

/* ---------------- 布局 ---------------- */
.app-layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--glass-strong);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px; border-bottom: 1px solid var(--border);
}
.sidebar-brand-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow); flex-shrink: 0;
}
.sidebar-brand-text { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.sidebar-brand-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px; }
.nav-section-title {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.2px; padding: 10px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 0; border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none; font-size: 13.5px;
  cursor: pointer; transition: all .15s ease;
  border: 1px solid transparent; background: none; width: 100%; text-align: left;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--accent-soft); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(249,115,22,.20), rgba(251,146,60,.12));
  color: #fff; border: 1px solid rgba(249,115,22,.32);
}
.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); }

/* ---------------- 主内容 ---------------- */
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 58px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid var(--border);
  background: var(--glass-strong);
  position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-secondary); }
.topbar-user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}

.container { padding: var(--safe-zone, 18vh) 26px 40px; max-width: 1400px; width: 100%; }

/* ---------------- 玻璃卡片 ---------------- */
.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card-subtitle { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }

/* ---------------- 统计 ---------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; align-items: center; gap: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  transition: border-color .15s ease, transform .15s ease;
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat-icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  background: var(--accent-soft);
}
.stat-value { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* ---------------- 表单 ---------------- */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text); font-size: 14px;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 15px; font-size: 13.5px; cursor: pointer;
  transition: all .15s ease; text-decoration: none; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--border-strong); background: rgba(255,255,255,.11); }
.btn-primary {
  background: linear-gradient(135deg, #f97316, #ea580c);
  border: none; color: #fff; font-weight: 600;
  box-shadow: 0 3px 14px rgba(249, 115, 22, 0.38);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-danger { background: rgba(248,113,113,.14); color: var(--danger); border: 1px solid rgba(248,113,113,.32); }
.btn-danger:hover:not(:disabled) { background: rgba(248,113,113,.24); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-lg { padding: 11px 22px; font-size: 14.5px; }

.flex { display: flex; }
.gap-12 { gap: 12px; }
.wrap { flex-wrap: wrap; }
.flex-center { align-items: center; }

/* ---------------- 搜索栏 ---------------- */
.search-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar .form-input { flex: 1; min-width: 200px; max-width: 340px; }

/* ---------------- 前缀 Tab ---------------- */
.prefix-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.prefix-tab {
  padding: 7px 15px; border-radius: 20px; cursor: pointer;
  font-size: 13px; color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--border);
  transition: all .15s ease; font-family: var(--mono);
}
.prefix-tab:hover { border-color: var(--border-strong); color: var(--text); }
.prefix-tab.active {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff; border-color: transparent; font-weight: 600;
}

/* ---------------- 表格 ---------------- */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--glass-soft);
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 11px 14px; font-size: 12px;
  color: var(--text-muted); font-weight: 600;
  background: rgba(14, 11, 8, 0.30);
  border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid rgba(255,178,100,.07); vertical-align: middle; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.key-cell { overflow-wrap: anywhere; word-break: break-all; }
.size-cell { white-space: nowrap; color: var(--text-secondary); }
.time-cell { white-space: nowrap; color: var(--text-muted); font-size: 12px; }
.actions-cell { white-space: nowrap; }
.actions-cell .btn + .btn { margin-left: 6px; }

input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); vertical-align: middle; }

/* 操作列 sticky 右（用较实玻璃，避免滚动透字） */
thead th:last-child, tbody td:last-child {
  position: sticky; right: 0; z-index: 2;
  background: var(--glass-solid);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 10px -8px rgba(0,0,0,.55);
}
tbody tr:hover td:last-child { background: rgba(22, 17, 13, 0.46); }

/* 排序表头 */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th .arrow { color: var(--accent); font-size: 10px; margin-left: 3px; }

/* ---------------- 空状态 ---------------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon { font-size: 40px; margin-bottom: 10px; }

/* ---------------- 分页 ---------------- */
.pagination { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.page-btn {
  background: rgba(0,0,0,.25); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: var(--radius-sm);
  padding: 6px 12px; cursor: pointer; font-size: 13px; transition: all .15s ease;
}
.page-btn:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-info { color: var(--text-muted); font-size: 13px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 300;
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 13.5px; display: none; max-width: 380px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
  animation: toastIn .2s ease;
}
.toast-success { background: rgba(74,222,128,.16); color: var(--success); border: 1px solid rgba(74,222,128,.32); }
.toast-error { background: rgba(248,113,113,.16); color: var(--danger); border: 1px solid rgba(248,113,113,.32); }
.toast-info { background: rgba(96,165,250,.16); color: var(--info); border: 1px solid rgba(96,165,250,.32); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------------- Modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.62); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center;
}
.modal {
  background: var(--glass-solid);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  width: 440px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal h2 { font-size: 17px; margin-bottom: 10px; }
.modal p { color: var(--text-secondary); font-size: 13.5px; margin-bottom: 20px; overflow-wrap: anywhere; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------- 分发工具 ---------------- */
.dist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.dist-item {
  background: var(--glass-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color .15s ease;
}
.dist-item:hover { border-color: var(--border-strong); }
.dist-icon {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.dist-name { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.dist-meta { font-size: 11.5px; color: var(--text-muted); }

/* 代码块 */
.code-block {
  background: rgba(0,0,0,.3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  white-space: pre-wrap; word-break: break-all; line-height: 1.6;
}

/* ---------------- 登录页 ---------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; }
.login-card {
  background: var(--glass);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 36px 34px; width: 360px; max-width: 92vw;
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.login-logo {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff; box-shadow: 0 6px 22px var(--accent-glow);
}
.login-title { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.login-err { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 18px; }

/* ---------------- 滚动条 ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.24); background-clip: content-box; }

@media (max-width: 860px) {
  .sidebar { width: 60px; }
  .sidebar-brand-text, .sidebar-brand-sub, .nav-section-title,
  .nav-item span { display: none; }
  .sidebar-brand { justify-content: center; padding: 16px 8px; }
  .nav-item { justify-content: center; padding: 10px; }
}
