:root {
  --bg: #f4f6fb;
  --bg-deep: #eaeef7;
  --card: #ffffff;
  --ink: #101828;
  --ink-2: #334155;
  --muted: #6b7688;
  --faint: #97a1b2;
  --line: #e5e9f2;
  --line-strong: #d5dbe8;
  --brand: #18181b;
  --brand-ink: #111113;
  --brand-soft: #f1f1f4;
  --good: #12a05c;
  --warn: #c9770a;
  --bad: #d93b3b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow: 0 10px 30px -12px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .04);
  --shadow-lg: 0 30px 70px -30px rgba(16, 24, 40, .35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }

::selection { background: #cfe0ff; }

/* ---------------------------------------------------------------- layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 20px;
  height: 62px; display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: #18181b;
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800;
  box-shadow: 0 4px 12px -8px rgba(9, 9, 11, .8);
}
.brand-name { font-size: 15px; }
.brand-name small { display: block; font-size: 10.5px; font-weight: 500; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; line-height: 1.2; }
.topbar-spacer { flex: 1; }

.tabs { display: flex; gap: 4px; align-items: center; }
.tab {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 550;
  padding: 8px 14px; border-radius: 9px; cursor: pointer;
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--bg-deep); color: var(--ink-2); }
.tab.is-active { background: var(--brand-soft); color: var(--brand-ink); }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.card-head h3 { font-size: 15px; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }
.card-body { padding: 20px; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .grid { grid-template-columns: minmax(0, 1fr); } }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border-radius: 10px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink-2);
  font: inherit; font-size: 13.5px; font-weight: 580;
  cursor: pointer; white-space: nowrap;
  transition: transform .06s, background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn:hover { background: #fbfcff; border-color: #c3ccdd; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
  background: #18181b;
  border-color: #18181b; color: #fff;
  box-shadow: 0 6px 16px -10px rgba(9, 9, 11, .8);
}
.btn-primary:hover { background: #000; border-color: #000; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg-deep); color: var(--ink); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-danger { color: var(--bad); border-color: #f3cfcf; }
.btn-danger:hover { background: #fff5f5; border-color: #eeb8b8; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 9px; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--faint); }
.input, select.input, textarea.input {
  height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit; font-size: 14px;
  outline: none; transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: #9db8ff; box-shadow: 0 0 0 3.5px rgba(47, 107, 255, .13); }
.input::placeholder { color: #aab3c2; }

.seg { display: inline-flex; background: var(--bg-deep); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 560;
  color: var(--muted); padding: 5px 10px; border-radius: 7px; cursor: pointer;
}
.seg button.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.switch input { appearance: none; width: 36px; height: 21px; border-radius: 99px; background: #ccd3e0; position: relative; cursor: pointer; transition: background .18s; margin: 0; }
.switch input:checked { background: var(--brand); }
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s;
}
.switch input:checked::after { transform: translateX(15px); }

.color-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 4px 8px 4px 4px; background: #fff; height: 38px; }
.color-chip input[type=color] { width: 30px; height: 28px; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 7px; }
.color-chip input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color-chip input[type=color]::-webkit-color-swatch { border: 1px solid var(--line); border-radius: 7px; }
.color-chip .val { font-family: var(--mono); font-size: 11.5px; color: var(--muted); width: 62px; border: 0; outline: none; }

/* ---------------------------------------------------------------- dropzone */
.dropzone {
  position: relative;
  border: 1.5px dashed #c7d2e6; border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfcff, #f6f8fe);
  padding: 40px 24px; text-align: center;
  cursor: pointer; transition: border-color .18s, background .18s, transform .18s;
}
.dropzone:hover { border-color: #9db8ff; background: #f8faff; }
.dropzone.is-drag { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.005); }
.dropzone .dz-icon {
  width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 14px;
  display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--brand);
}
.dropzone .dz-title { font-weight: 620; font-size: 15px; }
.dropzone .dz-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.upload-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.upl {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff;
}
.upl-name { font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl-meta { font-size: 11.5px; color: var(--faint); }
.upl-bar { height: 4px; border-radius: 99px; background: var(--bg-deep); overflow: hidden; margin-top: 5px; }
.upl-bar > i { display: block; height: 100%; width: 0%; background: var(--brand); border-radius: 99px; transition: width .2s; }
.upl.is-done .upl-bar > i { background: var(--good); }
.upl.is-error .upl-bar > i { background: var(--bad); }

/* ---------------------------------------------------------------- table */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint); padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafbff; }
.file-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-icon {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center; background: #f1f1f4; color: #3f3f46;
  font-size: 10px; font-weight: 750; letter-spacing: .02em; text-transform: uppercase;
}
.file-name { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.file-sub { font-size: 11.5px; color: var(--faint); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--bg-deep); color: var(--muted);
}
.badge.good { background: #e8f7ef; color: #0d7a46; }
.badge.warn { background: #fdf3e2; color: var(--warn); }
.badge.bad { background: #fdecec; color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }

.empty { padding: 44px 20px; text-align: center; color: var(--faint); font-size: 13.5px; }

/* ---------------------------------------------------------------- qr panel */
.qr-panel { position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow-y: auto; border-radius: var(--radius); }
.qr-stage {
  display: grid; place-items: center; padding: 22px 18px;
  border-radius: 14px; background:
    linear-gradient(0deg, rgba(16, 24, 40, .025), rgba(16, 24, 40, .025)),
    repeating-conic-gradient(#f0f3f9 0% 25%, #fff 0% 50%) 0 0 / 18px 18px;
  border: 1px solid var(--line);
  min-height: 268px;
}
.qr-stage canvas, .qr-stage svg { border-radius: 10px; max-width: 100%; height: auto; }
.qr-empty { color: var(--faint); font-size: 13px; text-align: center; line-height: 1.8; }
.qr-toolbar { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px 18px; border-top: 1px solid var(--line); }
.qr-group { display: flex; flex-direction: column; gap: 7px; }
.qr-group > .lbl { font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.qr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.logo-drop {
  display: flex; align-items: center; gap: 10px;
  border: 1px dashed var(--line-strong); border-radius: 10px; padding: 8px 10px;
  cursor: pointer; font-size: 12.5px; color: var(--muted);
}
.logo-drop:hover { border-color: #9db8ff; color: var(--ink-2); }
.logo-preview { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; background: #fff; border: 1px solid var(--line); }

/* ---------------------------------------------------------------- share page */
.share-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 28px 18px 40px;
  background:
    radial-gradient(900px 500px at 15% -10%, #e8f0ff 0%, transparent 60%),
    radial-gradient(700px 420px at 95% 0%, #e6fbfc 0%, transparent 55%),
    var(--bg);
}
.share-card {
  width: 100%; max-width: 520px; background: #fff;
  border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.share-top { padding: 26px 26px 0; display: flex; align-items: center; gap: 10px; }
.share-body { padding: 20px 26px 26px; }
.share-name { font-size: 19px; font-weight: 680; word-break: break-word; line-height: 1.35; }
.share-meta { color: var(--muted); font-size: 13px; margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share-preview {
  margin: 18px 0 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; max-height: 380px;
}
.share-preview video { background: #000; }
.share-preview img, .share-preview video { max-width: 100%; max-height: 380px; display: block; }
.share-preview iframe { width: 100%; height: 380px; border: 0; }
.share-cta { margin-top: 20px; display: flex; gap: 10px; }
.share-cta .btn { height: 46px; font-size: 15px; flex: 1; border-radius: 12px; }
.share-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; gap: 14px; align-items: center; }
.share-foot .qr-mini { width: 74px; height: 74px; flex: none; border-radius: 10px; border: 1px solid var(--line); padding: 5px; background: #fff; }
.share-foot .qr-mini canvas, .share-foot .qr-mini svg { width: 100%; height: 100%; display: block; }
.share-foot .txt { font-size: 12px; color: var(--muted); line-height: 1.65; }

/* ---------------------------------------------------------------- login */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1000px 500px at 20% 0%, #e9f1ff 0%, transparent 55%),
  radial-gradient(800px 400px at 90% 10%, #e6fbfc 0%, transparent 50%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 30px 28px; box-shadow: var(--shadow-lg); }
.auth-card .brand { justify-content: center; margin-bottom: 22px; }
.auth-title { font-size: 18px; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.auth-error { color: var(--bad); font-size: 12.5px; min-height: 18px; margin-top: 10px; }

/* ---------------------------------------------------------------- toast */
.toast-wrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #101828; color: #fff; font-size: 13px; padding: 9px 16px; border-radius: 10px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5); opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.good { background: #0d7a46; }
.toast.bad { background: #b92c2c; }

/* ---------------------------------------------------------------- dialogs */
dialog.modal {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(460px, 92vw);
  box-shadow: var(--shadow-lg); background: #fff;
}
dialog.modal::backdrop { background: rgba(16, 24, 40, .42); backdrop-filter: blur(2px); }
dialog.modal .card-head { border-bottom: 1px solid var(--line); }
dialog.modal .card-body { padding: 18px 20px; }
dialog.modal .card-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------------------------------------------------------- upload page */
.up-shell { min-height: 100vh; padding: 32px 18px 56px; background:
  radial-gradient(900px 460px at 50% -10%, #e8f0ff 0%, transparent 60%), var(--bg); }
.up-wrap { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.up-head { text-align: center; padding: 10px 0 6px; }
.up-head h1 { font-size: 21px; }
.up-head p { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.done-box { text-align: center; padding: 34px 20px; }
.done-icon { width: 56px; height: 56px; border-radius: 50%; background: #e8f7ef; color: var(--good); display: grid; place-items: center; margin: 0 auto 14px; }

.inline-note {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--brand-soft); color: #24408a; border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.6;
}

.kv-list { display: grid; grid-template-columns: 88px 1fr; gap: 6px 12px; font-size: 13px; }
.kv-list dt { color: var(--faint); }
.kv-list dd { margin: 0; word-break: break-all; }

hr.sep { border: 0; border-top: 1px solid var(--line); margin: 0; }

[hidden] { display: none !important; }

#qrStage canvas { width: 100% !important; height: auto !important; }
#filesBox, #linksBox, #recentBox { overflow-x: auto; }
.qr-panel::-webkit-scrollbar { width: 8px; }
.qr-panel::-webkit-scrollbar-thumb { background: #d5dbe8; border-radius: 8px; }




