* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue','Microsoft Yahei',sans-serif; background: #0b1230; color: #fff; }

.admin-wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.admin-header .links { display: flex; align-items: center; gap: 12px; }
.admin-header .title { font-size: 18px; font-weight: 600; }
.admin-header .back { color: #9fb3ff; text-decoration: none; }

.admin-form { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 14px; padding: 14px; backdrop-filter: blur(6px); }
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-row.two { flex-direction: row; gap: 12px; }
.form-row.two > div { flex: 1; min-width: 0; }
.admin-form label { font-size: 12px; color: #c7d2fe; }
.admin-form input, .admin-form textarea { width: 100%; border: 1px solid rgba(255,255,255,0.25); border-radius: 10px; padding: 10px; background: rgba(255,255,255,0.9); color: #111; font-size:16px; }
.admin-form select { font-size:16px; }
.admin-form textarea { resize: vertical; }

/* iOS Safari: 日期/时间输入在 flex 容器中可能超宽，限制为容器宽度 */
.admin-form input[type="date"],
.admin-form input[type="time"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}

.form-actions { display: flex; align-items: center; justify-content: space-between; }
.btn-primary { background: #2f6df6; color: #fff; border: none; border-radius: 10px; padding: 10px 16px; text-decoration: none; cursor:pointer; user-select:none; -webkit-user-select:none; -webkit-tap-highlight-color: transparent; }
.btn-secondary { display: inline-block; background: rgba(255,255,255,0.15); color: #fff; border-radius: 10px; padding: 10px 16px; text-decoration: none; border: none; cursor:pointer; user-select:none; -webkit-user-select:none; -webkit-tap-highlight-color: transparent; }
.btn-primary:active, .btn-secondary:active { transform: translateY(1px); filter: brightness(0.95); }
.btn-link { color: #9fb3ff; text-decoration: underline; background: transparent; padding: 0; border: none; cursor: pointer; }
.btn-warning { background: #f59e0b; color: #111; border: none; border-radius: 8px; padding: 6px 10px; }
.btn-danger { background: #ef4444; color: #fff; border: none; border-radius: 8px; padding: 6px 10px; }

.msg { margin-top: 10px; font-size: 13px; }
.msg.ok { color: #86efac; }
.msg.err { color: #fca5a5; }

.preview { margin-top: 18px; }
.preview h3 { margin: 0 0 10px; font-size: 16px; }
.preview-list { display: flex; flex-direction: column; gap: 12px; }
.preview-item { position: relative; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 12px; padding: 12px 14px 14px; }
/* 仅限定研报后台列表为网格布局，避免影响 AI 日报后台 */
#adminReportList .preview-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: start; }
#adminReportList .preview-item .thumb { width: 100%; height: auto; aspect-ratio: 3 / 4; border-radius: 4px; object-fit: cover; background: rgba(255,255,255,0.15); }
.preview-item .meta { display:flex; align-items:center; gap:12px; margin-bottom:6px; }
.preview-item .time { color: #93c5fd; font-size: 14px; font-weight:700; }
.preview-item .source-name { color:#60a5fa; font-size:14px; font-weight:700; text-decoration: none;}
.preview-item .source-name:hover { text-decoration: none; }
.preview-item .title { font-weight: 700; font-size:16px; margin-bottom:6px; display:-webkit-box; -webkit-line-clamp:1; -webkit-box-orient:vertical; overflow:hidden;}
.preview-item .content { color:#e5e7eb90; font-size:14px; line-height:1.5; }
.preview-item .content.clamp { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
/* 移除悬停/点击/聚焦时的下划线 */
.preview-item .source a:hover, .preview-item .source a:active, .preview-item .source a:focus { text-decoration: none; }
.preview-item .source a:focus { outline: none; }
/* 仅在研报后台列表中纵向排列操作按钮 */
#adminReportList .preview-item .ops { display: flex; gap: 8px; justify-self: end; flex-direction: column; }
.preview-item.dragging { opacity: 0.7; outline: 1px dashed rgba(255,255,255,0.4); }
.preview-item .title.report { -webkit-line-clamp:3 !important; -webkit-box-orient:vertical; overflow:hidden;}

/* 顶部右侧圆形操作按钮 */
.ops-overlay {position: absolute; top: -6px; right: -6px; display: flex; gap: 6px;}
.op-btn { width:34px; height:34px; border-radius:50%; border:none; display:inline-flex; align-items:center; justify-content:center; font-size:18px; font-weight:700; cursor:pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.op-btn.btn-publish { background:#22c55e; color:#fff; }
.op-btn.btn-edit { background:#2f6df6; color:#fff; }
.op-btn.danger { background:#ef4444; color:#fff; }
.op-btn:hover { filter: brightness(0.95); }
.op-btn:active { transform: translateY(1px); }
.op-btn img { width:16px; height:16px; display:block; }
/* 删除图标改为白色 */
.op-btn.danger img { filter: brightness(0) invert(1); }
/* 发布图标稍微放大 */
.op-btn.btn-publish img { width:22px; height:22px; margin-right: 3px;}

/* 排序模式：纵向箭头按钮组与栅格调整 */
.drag-handle { display:none; }
.move-group { display:none; align-items:center; justify-content:center; }
.move-group .stack { display:flex; flex-direction:column; gap:6px; }
/* 排序模式：仅作用于研报后台列表 */
.admin-wrap.sorting #adminReportList .preview-item { grid-template-columns: 34px 64px 1fr auto; }
.admin-wrap.sorting #adminReportList .move-group { display:flex; }

/* 底部悬浮排序工具栏 */
.sort-toolbar { position:fixed; left:0; right:0; bottom:0; display:none; padding:10px 16px; background: rgba(47,109,246,0.95); backdrop-filter: blur(6px); box-shadow: 0 -6px 16px rgba(0,0,0,0.25); z-index: 1000; }
.sort-toolbar .toolbar-inner { max-width: 760px; margin: 0 auto; display:flex; justify-content:space-between; align-items:center; gap:10px; }
.sort-toolbar .toolbar-left, .sort-toolbar .toolbar-right { display:flex; gap:10px; align-items:center; }
.sort-toolbar .btn-primary { background:#fff; color:#2f6df6; }
.sort-toolbar.show { display:block; }

/* 上下箭头小圆按钮 */
.move-btn { width:26px; height:26px; border-radius:50%; border:1px solid rgba(255,255,255,0.35); background:#fff; color:#111; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; }
.move-btn:hover { filter: brightness(0.95); }
.move-btn:active { transform: translateY(1px); }
.move-btn img { width:14px; height:14px; display:block; object-fit:contain; }
.move-btn.top.active { background:#22c55e; color:#fff; border-color:#16a34a; }
.preview-item.pinned { box-shadow: inset 3px 0 0 #22c55e; }

/* 胶囊按钮开关 */
.switch { display: inline-flex; align-items: center; gap: 8px; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .slider { position: relative; width: 44px; height: 24px; background: rgba(255,255,255,0.25); border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2); transition: background 0.2s ease; }
.switch .slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.2); transition: transform 0.2s ease; }
.switch input:checked + .slider { background: #2f6df6; }
.switch input:checked + .slider::after { transform: translateX(20px); }
.switch .switch-text { font-size: 12px; color: #c7d2fe; }
.form-tools { display: flex; justify-content: flex-end; }

/* 草稿页 Tabs */
.tabs { display:flex; gap:8px; margin-bottom:8px; }
.tabs .tab { padding:6px 12px; border-radius:6px; border:none; background:#e2e8f0; color:#111; cursor:pointer; }
.tabs .tab.active { background:#2f6df6; color:#fff; }
.tabs .tab:hover { filter: brightness(0.95); }

@media (hover: none) and (pointer: coarse) {
  #pasteLinkBtn { display: none; }
}
.preview-list#carouselList { column-count: 2; column-gap: 12px; }
#carouselList .preview-item { break-inside: avoid; display: block; margin: 0 0 12px; }
#carouselList .preview-item .thumb { width: 100%; height: auto; border-radius: 8px; object-fit: cover; }
#carouselList .preview-item .ops { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-top:8px; width:100%; }
#carouselList .preview-item .ops .left { display:flex; gap:8px; }
#carouselList .preview-item .ops .right { display:flex; gap:8px; }
#carouselList .preview-item .title.report { margin:8px 0 6px; }
#bgList.preview-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
#bgList .preview-item { display: flex; flex-direction: column; margin: 0; }
#bgList .preview-item .thumb-wrap { position: relative; }
#bgList .preview-item .thumb { width: 100%;  height: auto; border-radius: 8px; object-fit: cover; }
#bgList .preview-item .icon-btn { position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; border-radius: 999px; border: none; background: rgba(17,17,17,.6); display:flex; align-items:center; justify-content:center; cursor:pointer; }
#bgList .preview-item .icon-btn img { width: 16px; height: 16px; display:block; }
#bgList .preview-item .icon-btn.edit-btn { right: 44px; background: #16a34a; }
#bgList .preview-item .icon-btn.delete-btn { background: #dc2626; }
#bgList .preview-item .bg-badge { position: absolute; left: 8px; bottom: 8px; background: rgba(17,17,17,.6); color:#fff; font-size:12px; padding:4px 8px; border-radius:999px; }
#bgList .preview-item .ops { margin-top: auto; }
#bgList .preview-item .ops .btn-secondary { width: 100%; }
