:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-dim: #6e6e73;
  --line: #e3e3e6;
  --primary: #0071e3;
  --primary-dark: #0058b8;
  --danger: #d70015;
  --success: #1d8a3c;
  --warn: #b25000;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* ---------------------------------------------------------------- 登录/初始化 */

.center-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 36px 32px 32px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
}

.auth-card .subtitle {
  margin: 0 0 24px;
  color: var(--text-dim);
  font-size: 13px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(140deg, #0071e3, #00c6ff);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
}

.brand-name {
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* ---------------------------------------------------------------------- 布局 */

.app-view {
  display: grid;
  grid-template-columns: 208px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar .brand {
  padding: 0 8px 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13.5px;
  text-align: left;
  width: 100%;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover {
  background: #f2f2f5;
  color: var(--text);
}

.nav-item.active {
  background: #e8f1fd;
  color: var(--primary);
  font-weight: 500;
}

.nav-icon {
  width: 16px;
  text-align: center;
  font-size: 14px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12px;
}

.main {
  padding: 30px 34px 60px;
  max-width: 1180px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.page-head .desc {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

/* ---------------------------------------------------------------------- 组件 */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.card .hint {
  margin: 0 0 16px;
  color: var(--text-dim);
  font-size: 12.5px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  font-weight: 500;
}

input[type='text'],
input[type='password'],
input[type='number'],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

textarea {
  min-height: 168px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  white-space: nowrap;
}

.btn:hover {
  background: #f7f7f9;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-danger {
  color: var(--danger);
  border-color: #f0d0d3;
}

.btn-danger:hover {
  background: #fdf2f3;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: 7px;
}

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

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

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 760px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------- 表格 */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 9px 10px;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 11px 10px;
  border-bottom: 1px solid #f0f0f2;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fafafb;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.muted {
  color: var(--text-dim);
}

/* ---------------------------------------------------------------------- 徽标 */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
}

.tag-active {
  background: #e6f5ea;
  color: var(--success);
}

.tag-disabled {
  background: #f2f2f4;
  color: var(--text-dim);
}

.tag-admin {
  background: #e8f1fd;
  color: var(--primary);
}

.tag-user {
  background: #f2f2f4;
  color: var(--text-dim);
}

/* ---------------------------------------------------------------------- 统计 */

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.stat-label {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

/* ---------------------------------------------------------------------- 进度 */

.quota-bar {
  height: 5px;
  border-radius: 3px;
  background: #ececef;
  overflow: hidden;
  margin-top: 6px;
  min-width: 90px;
}

.quota-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.2s;
}

.quota-fill.warn {
  background: #e8a33d;
}

.quota-fill.full {
  background: var(--danger);
}

/* ---------------------------------------------------------------------- 提示 */

.alert {
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

.alert.show {
  display: block;
}

.alert-error {
  background: #fdf2f3;
  color: var(--danger);
  border: 1px solid #f7dcdf;
}

.alert-ok {
  background: #eef8f1;
  color: var(--success);
  border: 1px solid #d5ecdc;
}

.alert-info {
  background: #eef5fd;
  color: #0b5cad;
  border: 1px solid #d6e6f9;
}

/* ---------------------------------------------------------------------- 弹窗 */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.modal h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.modal .hint {
  margin: 0 0 18px;
  color: var(--text-dim);
  font-size: 12.5px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}

/* ---------------------------------------------------------------------- 其他 */

code {
  background: #f2f2f5;
  border-radius: 5px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.search-input {
  max-width: 240px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.credential-box {
  background: #f7f7f9;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px;
  max-height: 300px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.8;
  white-space: pre;
}

.connect-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid #f0f0f2;
  font-size: 13px;
}

.connect-line:last-child {
  border-bottom: 0;
}

.connect-line .label {
  color: var(--text-dim);
}

.connect-line .value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  text-align: right;
  word-break: break-all;
}

/* ---------------------------------------------------------------------- 用户资料信息网格 */

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
  margin-bottom: 6px;
}

@media (max-width: 640px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
}

.info-row {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #f0f0f2;
  font-size: 13px;
}

.info-k {
  color: var(--text-dim);
  min-width: 96px;
}

.info-v {
  font-weight: 500;
  word-break: break-all;
}

/* ---------------------------------------------------------------------- 面包屑 / 文件浏览器 */

.breadcrumb {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
}

.crumb {
  cursor: pointer;
  color: var(--primary);
}

.crumb:hover {
  text-decoration: underline;
}

.crumb-sep {
  color: #bbb;
  margin: 0 4px;
}

.fb-dir {
  color: var(--primary);
}

/* ---------------------------------------------------------------------- 下载客户端卡片 */

.dl-card {
  text-align: center;
}

.dl-icon {
  font-size: 34px;
  margin-bottom: 8px;
}

.dl-meta {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
  word-break: break-all;
}
