:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --border: #e3e8f0;
  --text: #1c2536;
  --muted: #6b7688;
  --primary: #3568e8;
  --primary-hover: #2857cc;
  --primary-soft: #eaf0ff;
  --danger: #d8453f;
  --danger-soft: #fdeceb;
  --success: #138a5e;
  --shadow: 0 1px 2px rgba(20, 34, 60, .04), 0 8px 24px rgba(20, 34, 60, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

.app { max-width: 1080px; margin: 0 auto; padding: 28px 20px 48px; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #3568e8, #6b91ff);
  position: relative; flex: none;
  box-shadow: 0 6px 16px rgba(53, 104, 232, .28);
}
.logo::after {
  content: ""; position: absolute; inset: 12px;
  border: 3px solid #fff; border-radius: 5px; opacity: .95;
}
.brand-text h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: .3px; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #b9c2d0; display: inline-block; }
.status.ok i { background: #25b577; }
.status.bad i { background: var(--danger); }
.status.ok span { color: var(--success); }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 20px;
}
.panel h2 { margin: 0 0 16px; font-size: 15px; font-weight: 650; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { margin-bottom: 12px; }
.label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.config-info {
  margin-top: 16px; padding: 12px 14px; border-radius: 10px;
  background: var(--primary-soft); color: #2c4fae; font-size: 12px; line-height: 1.8;
}
.row { display: flex; gap: 10px; }

input[type="text"], input[type="password"], select {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 9px; padding: 9px 12px; font-size: 13px; outline: none;
  font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(53, 104, 232, .12);
}
.row input { flex: 1; min-width: 0; }

.btn {
  border: 1px solid transparent; border-radius: 9px; padding: 9px 16px;
  font-size: 13px; font-weight: 550; font-family: inherit; cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn.ghost:hover:not(:disabled) { background: #f3f6fc; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn.danger { color: var(--danger); background: var(--danger-soft); }

.dropzone {
  border: 2px dashed #cdd7e8; border-radius: 12px; background: #fafbfe;
  padding: 34px 16px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dz-icon {
  width: 42px; height: 42px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-size: 26px; line-height: 42px; font-weight: 300;
}
.dz-title { font-size: 14px; font-weight: 550; }
.dz-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  background: #f1f4fa; border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 10px; font-size: 12px;
}
.chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.chip .size { color: var(--muted); }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 2px; }

.upload-bar { display: flex; align-items: flex-end; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
.upload-bar select { min-width: 140px; }
.custom-ttl { width: 190px; }
.upload-bar .btn.primary { margin-left: auto; }

.progress { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.progress-track { flex: 1; height: 8px; border-radius: 8px; background: #e9edf5; overflow: hidden; }
.progress-track > div { height: 100%; width: 0; background: var(--primary); border-radius: 8px; transition: width .15s; }
#progressText { font-size: 12px; color: var(--muted); min-width: 92px; text-align: right; }

.badge { background: var(--primary-soft); color: var(--primary); border-radius: 20px; padding: 2px 9px; font-size: 12px; margin-left: 6px; }
.results { display: grid; gap: 10px; }
.result-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.result-name { font-weight: 550; font-size: 13px; margin-bottom: 8px; word-break: break-all; }
.result-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.result-row { display: flex; gap: 8px; align-items: center; }
.link-input {
  flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; color: var(--text); background: #fafbfe;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
a.link-open { color: var(--primary); text-decoration: none; font-size: 12px; white-space: nowrap; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.stat-card { flex: 1; min-width: 130px; background: #f7f9fd; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.stat-card .k { font-size: 11px; color: var(--muted); }
.stat-card .v { font-size: 18px; font-weight: 650; margin-top: 3px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.media-card { border: 1px solid var(--border); border-radius: 11px; overflow: hidden; background: #fff; }
.thumb {
  height: 132px; background: #eef1f7; display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden; position: relative;
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .kind-tag {
  position: absolute; top: 8px; left: 8px; background: rgba(20, 30, 50, .68); color: #fff;
  font-size: 10px; padding: 2px 7px; border-radius: 5px;
}
.media-body { padding: 11px 12px; }
.media-name { font-size: 12px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.7; }
.media-meta .expire { color: #b46b10; }
.media-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 36px 0; font-size: 13px; }
.need-key { text-align: center; color: var(--muted); padding: 28px 0; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; font-size: 12px; color: var(--muted); }

.footer { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; padding: 4px 2px; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #1f2a3d; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.2); z-index: 100; max-width: 90vw;
}
.toast.error { background: #c0392f; }
.toast.success { background: #14805a; }

.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(14, 22, 38, .72); }
.modal-body {
  position: relative; z-index: 1; background: #fff; border-radius: 14px;
  padding: 18px; max-width: min(880px, 92vw); max-height: 88vh; overflow: auto;
  box-shadow: 0 24px 70px rgba(0,0,0,.3);
}
.modal-close {
  position: absolute; right: 10px; top: 8px; border: 0; background: rgba(0,0,0,.08);
  width: 30px; height: 30px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; color: #333;
}
.preview-media { display: block; max-width: 100%; max-height: 72vh; border-radius: 8px; }
.preview-link { display: block; margin-top: 12px; font-size: 12px; color: var(--primary); word-break: break-all; }

@media (max-width: 640px) {
  .app { padding: 18px 12px 36px; }
  .panel { padding: 16px; }
  .upload-bar .btn.primary { margin-left: 0; width: 100%; }
  .topbar-right .status { display: none; }
}
