/* ==========================================================================
   视频链接管理器 —— 样式
   设计目标：文件管理器式的信息密度 + 现代暗色 UI
   ========================================================================== */

:root {
  --bg: #0f1115;
  --bg-elev: #161922;
  --bg-elev-2: #1d212b;
  --bg-hover: #232836;
  --border: #262b38;
  --border-strong: #333a4a;
  --text: #e7eaf3;
  --text-dim: #9aa3b8;
  --text-faint: #6b7488;
  --accent: #6c8cff;
  --accent-strong: #8aa2ff;
  --accent-soft: rgba(108, 140, 255, 0.14);
  --danger: #ff5f6d;
  --danger-soft: rgba(255, 95, 109, 0.14);
  --success: #35d07f;
  --warn: #ffb648;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --topbar-h: 58px;
  --sidebar-w: 232px;
  --font: "Inter", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6fa;
    --bg-elev: #ffffff;
    --bg-elev-2: #eef0f6;
    --bg-hover: #e8ebf3;
    --border: #e0e3ec;
    --border-strong: #cbd0dd;
    --text: #1a1d26;
    --text-dim: #5c6478;
    --text-faint: #8b93a7;
    --accent: #3f63f5;
    --accent-strong: #2b4ee0;
    --accent-soft: rgba(63, 99, 245, 0.1);
    --danger: #e03131;
    --danger-soft: rgba(224, 49, 49, 0.1);
    --success: #12a05c;
    --shadow: 0 10px 30px rgba(20, 25, 45, 0.14);
    --shadow-sm: 0 2px 10px rgba(20, 25, 45, 0.08);
  }
}

* { box-sizing: border-box; }

/* hidden 属性必须始终生效（.modal/.player 等用了 display: grid，会盖掉默认样式表） */
[hidden] { display: none !important; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

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

::selection { background: var(--accent-soft); }

/* 滚动条 */
* ::-webkit-scrollbar { width: 10px; height: 10px; }
* ::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}
* ::-webkit-scrollbar-thumb:hover { background-color: var(--text-faint); background-clip: content-box; }
* ::-webkit-scrollbar-track { background: transparent; }

/* ============================== 按钮 ============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.06s, color 0.15s;
  user-select: none;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--bg-hover); }

.btn--danger { background: transparent; border-color: var(--border-strong); color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn--icon { width: 34px; padding: 0; }
.btn--sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn--icon.btn--sm { width: 28px; padding: 0; }
.btn--icon.btn--sm svg { width: 15px; height: 15px; }
.btn.is-disabled { opacity: 0.55; }

/* ============================== 顶栏 ============================== */

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.topbar__brand { display: flex; align-items: center; gap: 9px; min-width: 190px; }
.brand__logo svg { width: 26px; height: 26px; }
.brand__logo svg rect { fill: var(--accent); stroke: none; }
.brand__logo svg path { fill: #fff; stroke: none; }
.brand__text { font-weight: 650; letter-spacing: 0.2px; }

.topbar__center { flex: 1; display: flex; justify-content: center; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

.search {
  position: relative;
  width: min(560px, 100%);
  display: flex;
  align-items: center;
}
.search__icon {
  position: absolute;
  left: 10px;
  color: var(--text-faint);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 34px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { border-color: var(--accent); background: var(--bg); }
.search__clear {
  position: absolute;
  right: 6px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.search__clear:hover { background: var(--bg-hover); color: var(--text); }

/* ============================== 布局 ============================== */

.app {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow-x: clip;
}

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 10px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transition: margin-left 0.18s ease, transform 0.18s ease;
}

/* 桌面端：收起时整个移出布局 */
.app.is-collapsed .sidebar { margin-left: calc(var(--sidebar-w) * -1); }

.sidebar-scrim { position: fixed; inset: 0; z-index: 25; background: rgba(4, 6, 10, 0.5); }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav__group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.nav__group-action {
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.nav__group-action:hover { background: var(--bg-hover); color: var(--text); }

.nav__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  text-align: left;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
  border: 1px solid transparent;
}
.nav__item:hover { background: var(--bg-hover); color: var(--text); }
.nav__item.is-active {
  background: var(--accent-soft);
  border-color: rgba(108, 140, 255, 0.3);
  color: var(--text);
  font-weight: 600;
}
.nav__item svg { width: 16px; height: 16px; }
.nav__item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__count {
  font-style: normal;
  font-size: 11px;
  color: var(--text-faint);
  background: var(--bg-elev-2);
  border-radius: 20px;
  padding: 1px 7px;
  min-width: 22px;
  text-align: center;
}
.nav__item.is-active .nav__count { background: rgba(108, 140, 255, 0.22); color: var(--text); }

.nav__list { display: flex; flex-direction: column; gap: 2px; }
.nav__empty { padding: 6px 9px; color: var(--text-faint); font-size: 12.5px; }

.nav__item--category .cat-actions {
  display: none;
  gap: 4px;
  align-items: center;
}
.nav__item--category:hover .cat-actions { display: flex; }
.cat-action {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}
.cat-action:hover { background: var(--bg-elev-2); color: var(--text); }
.cat-action svg { width: 13px; height: 13px; }

.sidebar__footer {
  margin-top: auto;
  padding: 10px 8px 2px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex: none; }
.status__dot--ok { background: var(--success); box-shadow: 0 0 0 3px rgba(53, 208, 127, 0.16); }
.status__dot--err { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.status__dot--busy { background: var(--warn); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.status__hint { font-size: 11.5px; color: var(--text-faint); }

/* ============================== 主区域 ============================== */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.toolbar {
  flex: none;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-dim); }
.crumb--current { color: var(--text); font-weight: 600; }

.toolbar__right { display: flex; align-items: center; gap: 8px; }

.segmented {
  display: flex;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}
.segmented__btn {
  width: 28px;
  height: 26px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--text-faint);
  cursor: pointer;
}
.segmented__btn svg { width: 15px; height: 15px; }
.segmented__btn:hover { color: var(--text); }
.segmented__btn.is-active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }

.bulkbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.bulkbar__all { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.bulkbar__count { color: var(--text-dim); }
.bulkbar__actions { margin-left: auto; display: flex; gap: 8px; }

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.statusbar {
  flex: none;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 12px;
  color: var(--text-faint);
}
.statusbar__sep { opacity: 0.5; }
.statusbar__grow { flex: 1; }

/* ============================== 网格视图 ============================== */

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

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card.is-playing { border-color: var(--accent); }

.card__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(140deg, var(--bg-elev-2), #0c0e13);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb__glyph { color: var(--text-faint); opacity: 0.75; }
.thumb__glyph svg { width: 34px; height: 34px; stroke-width: 1.4; }

.card__type {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  backdrop-filter: blur(4px);
}
.card__fav {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.card:hover .card__fav, .card__fav.is-on { opacity: 1; }
.card__fav.is-on { color: var(--warn); }
.card__fav svg { width: 15px; height: 15px; }
.card__fav.is-on svg { fill: currentColor; }

.card__check {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  cursor: pointer;
  opacity: 0;
}
.card:hover .card__check, .card__check:checked { opacity: 1; }

.card__body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 5px; }
.card__title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.card__meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-faint); }
.card__cat {
  padding: 0 6px;
  border-radius: 5px;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card__tags { display: flex; flex-wrap: wrap; gap: 4px; }
.card__author { font-size: 11.5px; color: var(--text-faint); }
.row__author { font-style: normal; font-size: 11.5px; color: var(--text-faint); margin-left: 6px; }

/* 没有写权限时隐藏所有编辑类入口（[data-action] 选择器在下面统一处理） */
body[data-can-write="0"] [data-action="edit"],
body[data-can-write="0"] [data-action="delete"],
body[data-can-write="0"] [data-action="fav"],
body[data-can-write="0"] [data-action="select"],
body[data-can-write="0"] .card__check,
body[data-can-write="0"] .row__check,
body[data-can-write="0"] #selectModeBtn,
body[data-can-write="0"] #bulkbar,
body[data-can-write="0"] #importBtn,
body[data-can-write="0"] #newBtn { display: none !important; }
.tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.card__actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.card:hover .card__actions { opacity: 1; }
.icon-btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-elev);
  color: var(--text-dim);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn--danger:hover { color: var(--danger); border-color: var(--danger); }
.icon-btn svg { width: 14px; height: 14px; }

/* ============================== 列表视图 ============================== */

.list { display: flex; flex-direction: column; gap: 4px; }

.row {
  display: grid;
  grid-template-columns: 24px 32px minmax(0, 2.4fr) minmax(0, 1.6fr) 110px 92px 108px;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg-elev);
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.row:hover { background: var(--bg-hover); border-color: var(--border); }
.row.is-selected { border-color: var(--accent); background: var(--accent-soft); }

.row__check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; opacity: 0; }
.row:hover .row__check, .row__check:checked { opacity: 1; }

.row__icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--bg-elev-2);
  color: var(--text-dim);
}
.row__icon svg { width: 16px; height: 16px; }
.row__icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }

.row__title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__title .fav-mark { color: var(--warn); margin-right: 4px; }
.row__url {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row__cat, .row__type, .row__time { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__type b {
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--bg-elev-2);
  color: var(--text-dim);
}
.row:hover .row__type b { background: var(--bg); }
.row__actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; }
.row:hover .row__actions { opacity: 1; }

.list__head {
  display: grid;
  grid-template-columns: 24px 32px minmax(0, 2.4fr) minmax(0, 1.6fr) 110px 92px 108px;
  gap: 10px;
  padding: 4px 10px 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* ============================== 空态 / 骨架 ============================== */

.empty {
  height: 100%;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--text-dim);
}
.empty__icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
}
.empty__icon svg { width: 32px; height: 32px; stroke-width: 1.4; color: var(--text-faint); }
.empty h3 { margin: 0; font-size: 16px; color: var(--text); }
.empty p { margin: 0; max-width: 460px; font-size: 13px; }
.empty code { font-family: var(--mono); background: var(--bg-elev-2); padding: 1px 5px; border-radius: 5px; }

.skeleton {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, var(--bg-elev) 30%, var(--bg-elev-2) 50%, var(--bg-elev) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { to { background-position: -120% 0; } }

/* ============================== 播放器 ============================== */

.player {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
}
.player__backdrop { position: absolute; inset: 0; background: rgba(4, 6, 10, 0.78); backdrop-filter: blur(6px); }
.player__panel {
  position: relative;
  width: min(1180px, 94vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #0b0d12;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop 0.16s ease-out;
}
@keyframes pop { from { transform: scale(0.97); opacity: 0; } }

.player__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
}
.player__title {
  font-weight: 620;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.player__badges { display: flex; gap: 6px; flex: none; }
.player__badges .tag { background: var(--bg-elev-2); color: var(--text-dim); }
.player__barActions { margin-left: auto; display: flex; gap: 5px; flex: none; }
.player__barActions .is-on { color: var(--warn); }
.player__barActions .is-on svg { fill: currentColor; }

.player__stage {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
  max-height: calc(92vh - 130px);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.player__stage video, .player__stage audio { width: 100%; height: 100%; background: #000; outline: none; }
.player__stage audio { height: 62px; padding: 0 18px; background: var(--bg-elev); }
.player__stage iframe { width: 100%; height: 100%; border: 0; }

.player__placeholder { color: var(--text-dim); text-align: center; padding: 24px; display: grid; gap: 10px; place-items: center; }
.player__placeholder strong { color: var(--text); }

.player__info {
  padding: 9px 12px 11px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  display: grid;
  gap: 5px;
  color: var(--text);
}
.player__meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-dim); }
.player__link {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent-strong);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player__link:hover { text-decoration: underline; }

/* ============================== 弹窗 ============================== */

.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 18px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(4, 6, 10, 0.7); backdrop-filter: blur(4px); }
.modal__panel {
  position: relative;
  width: min(560px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop 0.15s ease-out;
}
.modal__panel--narrow { width: min(480px, 100%); }
.modal__panel--tiny { width: min(400px, 100%); }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
}
.modal__header h2 { margin: 0; font-size: 15px; }
.modal__body { padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 15px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.confirm__text { margin: 0; color: var(--text-dim); }

/* ============================== 表单 ============================== */

.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.field__label .req { color: var(--danger); }
.field__hint { font-size: 11.5px; color: var(--text-faint); }
.field input[type="text"],
.field input[type="url"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-size: 13.5px;
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field--inline { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.field--inline input { width: 16px; height: 16px; accent-color: var(--accent); }
.field--inline span { font-size: 13px; color: var(--text); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-error {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  border: 1px solid rgba(255, 95, 109, 0.4);
  color: var(--danger);
  font-size: 12.5px;
}

.settings__status {
  font-size: 12.5px;
  color: var(--text-dim);
  min-height: 18px;
  line-height: 1.5;
}
.settings__status.is-ok { color: var(--success); }
.settings__status.is-err { color: var(--danger); }
.settings__status code { font-family: var(--mono); }

/* ============================== Toast ============================== */

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 220px;
  max-width: 340px;
  padding: 10px 13px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: slide-in 0.18s ease-out;
  pointer-events: auto;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.toast::before {
  content: "";
  width: 3px;
  align-self: stretch;
  border-radius: 3px;
  background: var(--accent);
  flex: none;
}
.toast--ok::before { background: var(--success); }
.toast--err::before { background: var(--danger); }
.toast--warn::before { background: var(--warn); }
.toast.is-out { animation: slide-out 0.18s ease-in forwards; }
@keyframes slide-in { from { transform: translateX(18px); opacity: 0; } }
@keyframes slide-out { to { transform: translateX(18px); opacity: 0; } }

/* ============================== 启动失败兜底 ============================== */

/* 未捕获错误提示条 */
.crash {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 150;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  background: var(--danger-soft);
  border-top: 1px solid var(--danger);
  color: var(--danger);
  font-family: var(--mono);
  font-size: 12px;
}
.crash span { flex: 1; white-space: pre-wrap; word-break: break-word; }
.crash__close {
  flex: none;
  padding: 2px 10px;
  border: 1px solid var(--danger);
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
}

.boot-error {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 8vh 10vw;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}
.boot-error h2 { margin: 0 0 6px; font-size: 20px; }
.boot-error p { margin: 0; color: var(--text-dim); }
.boot-error code, .boot-error pre {
  font-family: var(--mono);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
}
.boot-error pre { margin: 6px 0; padding: 10px 12px; color: var(--text); }

/* ============================== 响应式 ============================== */

@media (max-width: 900px) {
  :root { --sidebar-w: 190px; }
  .brand__text { display: none; }
  .topbar__brand { min-width: auto; }
  .row, .list__head { grid-template-columns: 24px 32px minmax(0, 2fr) 92px 82px; }
  .row__cat, .row__url, .list__head > :nth-child(4), .list__head > :nth-child(5) { display: none; }
}

@media (max-width: 680px) {
  .app { position: relative; }
  .sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .row, .list__head { grid-template-columns: 24px 30px minmax(0, 1fr) 74px; }
  .row__cat, .row__url, .row__time { display: none; }
  .player__panel { width: 100vw; max-height: 100vh; border-radius: 0; }
  .field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
