/* MC 备份同步系统 · 控制台样式
 * 设计令牌与《UI 原型》完全一致，保证三份交付物视觉口径统一。
 * 语义色约定（N5）：主色=正常/最新，琥珀=落后，蓝=有未备份改动，红=失败/破坏性。
 */
:root {
  --bg: #eef1f5; --panel: #fff; --ink: #0f1b2d; --ink2: #33455c; --muted: #64748b; --muted2: #93a3b6;
  --line: #e2e8f0; --line2: #cfd8e3; --soft: #f7f9fc;
  --brand: #2f8f4e; --brand-ink: #1b6b38; --brand-soft: #e9f6ee; --brand-line: #bfe3cd;
  --ok: #2f8f4e; --ok-soft: #e9f6ee;
  --blue: #2563eb; --blue-soft: #e8f0fe; --blue-line: #bcd3f7;
  --amber: #b45309; --amber-soft: #fef3e2; --amber-line: #f0d9a0;
  --red: #dc2626; --red-soft: #fdeaea; --red-line: #f6cccc;
  --violet: #7c3aed; --violet-soft: #f2ebfe;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 4px 16px rgba(15, 27, 45, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-ink); }
button, input, select { font-family: inherit; font-size: inherit; }
[v-cloak] { display: none; }

/* ── 骨架 ───────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 216px; flex: 0 0 216px; background: #fff; border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 18px; font-weight: 650; letter-spacing: -.01em; }
.brand .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--brand); }
.brand small { display: block; font-weight: 400; color: var(--muted2); font-size: 11px; letter-spacing: 0; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px;
  color: var(--ink2); cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--soft); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav-badge { margin-left: auto; font-size: 11px; color: var(--muted2); font-family: var(--mono); }
.side-foot { margin-top: auto; padding: 10px 11px; color: var(--muted2); font-size: 11px; border-top: 1px solid var(--line); }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

/* ── 卡片与栅格 ─────────────────────────────────────── */
.grid { display: grid; gap: 14px; }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(216px, 1fr)); }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card-title { font-size: 13px; color: var(--muted); margin: 0 0 8px; font-weight: 500; }
.metric { font-size: 26px; font-weight: 640; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

.bar { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .3s ease; }
.bar.warn > i { background: var(--amber); }
.bar.bad > i { background: var(--red); }

/* ── 表格 ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; background: var(--soft); font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfdff; }
td.mono, .mono { font-family: var(--mono); font-size: 12px; }
.empty { padding: 40px 18px; text-align: center; color: var(--muted2); }

/* ── 标记与按钮 ─────────────────────────────────────── */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 12px; border: 1px solid transparent; }
.tag.ok { background: var(--ok-soft); color: var(--brand-ink); border-color: var(--brand-line); }
.tag.warn { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.tag.bad { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.tag.info { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
.tag.mute { background: var(--soft); color: var(--muted); border-color: var(--line2); }
.tag.violet { background: var(--violet-soft); color: var(--violet); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line2); background: #fff; color: var(--ink2); cursor: pointer;
  transition: background .15s ease, border-color .15s ease; font-weight: 500;
}
.btn:hover:not(:disabled) { background: var(--soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-ink); }
.btn.danger { border-color: var(--red-line); color: var(--red); }
.btn.danger:hover:not(:disabled) { background: var(--red-soft); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; border: 1px solid; margin-bottom: 10px; }
.alert.warn { background: var(--amber-soft); border-color: var(--amber-line); color: #7c3d06; }
.alert.error { background: var(--red-soft); border-color: var(--red-line); color: #991b1b; }
.alert.info { background: var(--blue-soft); border-color: var(--blue-line); color: #1e40af; }

/* ── 表单 ───────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink2); margin-bottom: 5px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted2); margin-top: 4px; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line2); border-radius: 9px;
  background: #fff; color: var(--ink); outline: none;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.switch { display: flex; align-items: center; gap: 8px; }
.switch input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ── 登录页 ─────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 380px; }
.login .card-pad { padding: 26px 26px 22px; }

/* ── 模态 ───────────────────────────────────────────── */
.mask { position: fixed; inset: 0; background: rgba(15, 27, 45, .42); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(15, 27, 45, .25); }
.modal-head { padding: 18px 20px 0; font-weight: 640; font-size: 16px; }
.modal-body { padding: 14px 20px; color: var(--ink2); font-size: 13px; }
.modal-foot { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 10px; }
.modal-foot.between { justify-content: space-between; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 60; max-width: 380px;
  padding: 12px 15px; border-radius: 10px; box-shadow: var(--shadow); border: 1px solid;
  background: #fff; font-size: 13px;
}
.toast.ok { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-ink); }
.toast.bad { border-color: var(--red-line); background: var(--red-soft); color: #991b1b; }

.spinner { width: 15px; height: 15px; border: 2px solid var(--line2); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { width: 100%; flex: none; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-foot { display: none; }
  .main { padding: 18px 16px 48px; }
}

/* Environment, world and device-task workspaces. */
button:focus-visible, a:focus-visible { outline: 3px solid var(--brand-line); outline-offset: 3px; }
.text-btn { border: 0; padding: 0; background: none; color: var(--brand-ink); cursor: pointer; font-weight: 500; text-align: left; }
.text-btn:disabled { opacity: .45; cursor: not-allowed; }
.mobile-logout { display: none; }
.eyebrow { color: var(--brand-ink); font-size: 11px; letter-spacing: .09em; margin-bottom: 5px; }
.break-all { overflow-wrap: anywhere; word-break: break-word; }
.button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.persistent-error { justify-content: space-between; }
.scope-note { display: flex; gap: 14px; padding: 17px 20px; background: linear-gradient(110deg, #e9f6ee, #f6faf6); border: 1px solid var(--brand-line); border-radius: 12px; margin-bottom: 22px; }
.scope-symbol { font-size: 27px; color: var(--brand); line-height: 1.3; }
.scope-note strong { font-size: 13px; color: var(--brand-ink); }
.scope-note p { color: #547360; font-size: 12px; margin: 3px 0 0; }
.catalog-toolbar, .task-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 0 18px; }
.catalog-toolbar > select { width: 180px; }
.search-field { display: flex; align-items: center; flex: 1; max-width: 460px; min-width: 220px; position: relative; }
.search-field > span { position: absolute; left: 13px; font-size: 22px; color: var(--muted); }
.search-field > input { padding-left: 39px; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(295px, 1fr)); gap: 16px; }
.subject-card { padding: 20px; transition: box-shadow .16s, border-color .16s; }
.subject-card:hover { border-color: var(--brand-line); box-shadow: 0 5px 20px rgba(30, 80, 50, .06); }
.subject-top { display: flex; align-items: center; gap: 12px; }
.subject-top > div:nth-child(2) { flex: 1; min-width: 0; }
.subject-icon { height: 42px; width: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 24px; flex: none; }
.subject-icon.world { background: #edf2ff; color: #5073b9; }
.subject-name { padding: 0; border: 0; background: none; font-size: 16px; font-weight: 650; text-align: left; color: var(--ink); cursor: pointer; overflow-wrap: anywhere; }
.subject-name:hover { color: var(--brand-ink); }
.subject-runtime { margin: 20px 0 10px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.subject-runtime span { color: var(--muted); font-size: 12px; }
.subject-stats { display: flex; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.no-revision { min-height: 55px; padding-top: 9px; color: var(--muted); font-size: 12px; }
.location-preview { display: flex; flex-direction: column; margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; gap: 3px; }
.subject-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 17px; }
.subject-card .hint { font-size: 11px; color: var(--muted); margin: 10px 0 0; }
.empty-state { padding: 42px 25px; }
.empty-state h2 { font-size: 17px; color: var(--ink2); font-weight: 600; margin: 8px 0; }
.empty-state p { margin: 0 auto 16px; color: var(--muted); max-width: 440px; }
.empty-icon { color: var(--brand); font-size: 36px; }
.history-heading { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.history-heading > div { flex: 1; min-width: 190px; }
.history-heading h2 { font-size: 18px; margin: 0; }
.history-heading p { margin: 3px 0 0; }
.history-card, .revision-detail, .manifest-card { margin-bottom: 18px; overflow: hidden; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.section-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.section-head p { margin-bottom: 0; }
.selected-row, tbody tr.selected-row:hover { background: var(--brand-soft); }
.revision-identity { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 6px 12px; padding: 16px 20px; font-size: 12px; color: var(--muted); }
.revision-identity code { color: var(--ink2); font-size: 11px; overflow-wrap: anywhere; }
.fixed-environment { margin: 0 20px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.fixed-environment > div { min-width: 0; }
.fixed-environment strong { color: var(--brand-ink); }
.detail-note { margin: 0 20px 18px; color: var(--muted); font-size: 12px; }
.manifest-toolbar { display: flex; gap: 14px; padding: 14px 20px; flex-wrap: wrap; align-items: center; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.filter-chips button { border: 1px solid var(--line); border-radius: 7px; padding: 5px 9px; background: white; color: var(--muted); cursor: pointer; font-size: 12px; }
.filter-chips button.active { color: var(--brand-ink); background: var(--brand-soft); border-color: var(--brand-line); }
.manifest-toolbar > input { width: 220px; }
.manifest-table .file-path { white-space: normal; min-width: 180px; max-width: 540px; overflow-wrap: anywhere; }
.pagination { border-top: 1px solid var(--line); padding: 13px 20px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.receiver-note { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px; margin-bottom: 22px; }
.receiver-note strong { color: var(--brand-ink); }
.receiver-note p { color: var(--muted); font-size: 12px; margin: 5px 0 0; max-width: 550px; }
.receiver-command { display: flex; gap: 10px; align-items: center; background: var(--soft); border-radius: 8px; padding: 10px 12px; flex: none; }
.receiver-command code { font-family: var(--mono); font-size: 12px; }
.task-toolbar { justify-content: space-between; }
.task-toolbar select { width: 175px; }
.task-card { margin-bottom: 13px; padding: 19px 21px; }
.task-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.task-top h3 { margin: 0; font-size: 14px; font-weight: 600; }
.task-subject { color: var(--muted); font-weight: 400; margin-left: 10px; }
.task-progress { display: flex; gap: 12px; align-items: center; font-size: 12px; color: var(--brand-ink); margin-top: 14px; }
.task-progress .bar { flex: 1; margin: 0; }
.task-message { margin: 13px 0 9px; font-size: 12px; color: var(--ink2); overflow-wrap: anywhere; }
.task-message.failure { color: var(--red); background: var(--red-soft); padding: 9px 12px; border-radius: 7px; }
.task-details { display: flex; flex-wrap: wrap; gap: 5px 17px; font-size: 11px; color: var(--muted); }
.task-result { border-top: 1px solid var(--line); margin-top: 13px; padding-top: 11px; display: flex; flex-wrap: wrap; gap: 7px 18px; font-size: 12px; }
.split-modal { max-width: 660px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.split-modal .modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.split-modal .modal-head h2 { font-size: 17px; margin: 0; }
.split-modal .modal-head .text-btn { font-size: 24px; line-height: 1; color: var(--muted); }
.split-modal .modal-body { overflow-y: auto; padding-top: 17px; }
.split-modal .modal-foot { border-top: 1px solid var(--line); flex: none; }
.modal-subject { display: flex; align-items: center; gap: 9px; font-size: 16px; margin-bottom: 12px; }
.modal-version { display: flex; flex-wrap: wrap; gap: 5px 16px; background: var(--soft); padding: 13px 15px; border-radius: 9px; margin-bottom: 12px; font-size: 12px; }
.modal-version code { width: 100%; font-size: 11px; color: var(--muted); }
.modal-environment { border-left: 3px solid var(--brand-line); padding: 3px 12px; margin: 12px 0 17px; font-size: 12px; }
.modal-environment p { margin: 4px 0; }
.restore-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 17px; }
.restore-mode button { border: 1px solid var(--line2); border-radius: 9px; padding: 12px; background: white; text-align: left; cursor: pointer; color: var(--ink2); }
.restore-mode button.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.restore-mode button:disabled { cursor: not-allowed; }
.restore-mode span { display: block; font-size: 11px; margin-top: 3px; color: var(--muted); }
.target-location { display: grid; grid-template-columns: 76px minmax(0, 1fr); font-size: 12px; gap: 7px 12px; padding: 12px 15px; background: var(--soft); border-radius: 9px; margin: 0 0 16px; }
.target-location > span { color: var(--muted); }
.target-location strong { font-weight: 500; display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.target-location code { font-size: 11px; }
.operation-scope { font-size: 12px; margin: 0 0 14px; }
.operation-scope strong { font-size: 12px; }
.operation-scope p { margin: 4px 0 0; color: var(--muted); }
@media (min-width: 761px) { .side { position: sticky; top: 0; height: 100vh; } }
@media (max-width: 960px) { .receiver-note { flex-wrap: wrap; } .fixed-environment { flex-wrap: wrap; } }
@media (max-width: 760px) {
  .side { padding: 12px 10px; gap: 3px; align-items: center; }
  .side .brand { min-width: 150px; padding: 4px 8px; }
  .nav-item { width: auto; flex: none; white-space: nowrap; padding: 8px 10px; }
  .mobile-logout { display: flex; }
  .grid.c2 { grid-template-columns: minmax(0, 1fr); }
  .catalog-toolbar .search-field { max-width: none; width: 100%; flex-basis: 100%; }
  .subject-grid { grid-template-columns: minmax(0, 1fr); }
  .scope-note { padding: 14px; }
  .section-head { padding: 15px; }
  .revision-identity { grid-template-columns: minmax(0, 1fr); padding: 14px 15px; }
  .fixed-environment { margin: 0 15px 15px; }
  .receiver-note { padding: 16px; }
  .receiver-command { flex-wrap: wrap; max-width: 100%; }
  .manifest-toolbar { padding: 12px 15px; }
  .manifest-toolbar > input { width: 100%; }
  .task-card { padding: 16px; }
  .task-top > .button-row { width: 100%; }
  .mask { padding: 10px; }
  .split-modal { max-height: calc(100dvh - 20px); }
  .restore-mode { grid-template-columns: minmax(0, 1fr); }
  .target-location { grid-template-columns: 65px minmax(0, 1fr); }
}

.manifest-card > summary { cursor: pointer; padding: 18px 22px; font-weight: 600; }
