/* ===== 局域网文件传输 - 全局样式（浅色主题） ===== */
:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ===== 登录弹层 ===== */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: var(--card); border-radius: 14px; padding: 32px;
  width: 380px; max-width: 90vw; box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.login-card h1 { font-size: 20px; margin-bottom: 8px; }
.login-hint { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.login-card input {
  width: 100%; padding: 10px 12px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 15px;
  letter-spacing: 2px;
}
.error-text { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ===== 顶栏 ===== */
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px; height: 56px;
}
.brand { font-weight: 600; font-size: 16px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 6px 14px; border-radius: 8px; color: var(--text);
  text-decoration: none; font-size: 14px;
}
.nav-link:hover { background: var(--bg); }
.nav-link.active { background: var(--primary); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.role-badge {
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.role-badge.read { background: #dbeafe; color: #1d4ed8; }
.role-badge.write { background: #dcfce7; color: #15803d; }

/* ===== 主区域 ===== */
.main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; font-size: 14px; transition: all .15s; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 上传页 ===== */
.dropzone {
  border: 2px dashed #cbd5e1; border-radius: var(--radius);
  background: var(--card); padding: 48px 24px; text-align: center;
  transition: all .2s;
}
.dropzone.dragover {
  border-color: var(--primary); background: #eff6ff; transform: scale(1.01);
}
.dropzone-icon { font-size: 42px; }
.dropzone-title { font-size: 17px; font-weight: 600; margin: 10px 0 4px; }
.dropzone p.muted { margin-bottom: 14px; }

.upload-list { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.upload-item, .transfer-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.upload-item .u-head, .transfer-item .t-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.u-name { font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-meta { color: var(--muted); font-size: 12px; }
.u-status { font-size: 12px; font-weight: 600; }
.u-status.uploading { color: var(--primary); }
.u-status.done { color: var(--success); }
.u-status.error { color: var(--danger); }
.u-status.paused { color: #b45309; }

.progress-bar {
  height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden;
}
.progress-bar .fill {
  height: 100%; background: var(--primary); border-radius: 999px;
  transition: width .3s ease;
}
.progress-bar .fill.done { background: var(--success); }
.progress-bar .fill.error { background: var(--danger); }

.u-footer { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.u-stats { flex: 1; color: var(--muted); font-size: 12px; }

/* ===== 文件列表 ===== */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.search-input {
  flex: 1; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; max-width: 320px;
}
.file-table {
  width: 100%; background: var(--card); border-collapse: collapse;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.file-table th, .file-table td {
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border);
}
.file-table th {
  background: #f8fafc; font-weight: 600; cursor: pointer; user-select: none;
  white-space: nowrap;
}
.file-table th:hover { background: #f1f5f9; }
.file-table tbody tr:hover { background: #f8fafc; }
.file-table .sort-ind { font-size: 10px; color: var(--muted); }
.file-table th.sorted .sort-ind { color: var(--primary); }
.hash-cell { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 11px; color: var(--muted); }
.actions { display: flex; gap: 6px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* ===== 传输看板 ===== */
.transfer-summary {
  display: flex; gap: 24px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; font-size: 13px;
}
.transfer-board { display: flex; flex-direction: column; gap: 10px; }
.t-kind { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.t-kind.up { background: #dbeafe; color: #1d4ed8; }
.t-kind.down { background: #fef3c7; color: #b45309; }
.t-peer { color: var(--muted); font-size: 12px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

/* ===== P2P 设备直传 ===== */
.p2p-badge {
  font-size: 11px; font-weight: 500; color: #16a34a;
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 20px;
  padding: 2px 8px; margin-left: 6px; vertical-align: 2px;
}
.conn-ok { color: #16a34a !important; font-weight: 500; }
.p2p-device-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px;
}
.p2p-device-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.p2p-device-icon { font-size: 26px; }
.p2p-device-info { flex: 1; min-width: 0; }
.p2p-device-name { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p2p-device-fp { font-size: 12px; }
.p2p-pin-big {
  font-size: 44px; font-weight: 700; letter-spacing: 10px; text-align: center;
  color: var(--primary); background: #eff6ff; border: 2px dashed var(--primary);
  border-radius: var(--radius); padding: 16px; margin: 14px 0;
}
.row-gap { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
#p2p-pin-input { text-align: center; font-size: 22px; letter-spacing: 8px; }
