/* ============================================================
   Registry Sync Panel — DeepSeek 风格设计系统
   主色 #4D6BFE，浅色留白，圆角，柔和阴影
   ============================================================ */
:root {
  --primary: #4d6bfe;
  --primary-hover: #3d5bf5;
  --primary-active: #3550e0;
  --primary-soft: #eef1fe;
  --primary-soft-2: #f5f7ff;

  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --border: #e5e6eb;
  --border-2: #f2f3f5;

  --success: #00b42a;
  --success-bg: #e8ffea;
  --warn: #ff7d00;
  --warn-bg: #fff7e8;
  --danger: #f53f3f;
  --danger-bg: #ffece8;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 2px 8px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .03);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, .07);
  --shadow-lg: 0 16px 56px rgba(29, 33, 41, .18);

  --sidebar-w: 236px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
.hint { color: var(--text-3); font-size: 12.5px; }
code { font-family: "SFMono-Regular", Consolas, monospace; background: var(--border-2); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; color: var(--text-2); }

::selection { background: rgba(77, 107, 254, .18); }
/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #dcdfe6; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c4c8d0; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ 登录 ============================ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(1000px 600px at 15% -10%, #e7ecff 0%, transparent 55%),
    radial-gradient(900px 600px at 110% 110%, #eaf6ff 0%, transparent 50%),
    #f7f8fa;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--card);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-md);
  padding: 40px 34px 32px; border: 1px solid rgba(255, 255, 255, .6);
}
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 16px;
  background: linear-gradient(135deg, #5b7cfa 0%, #4d6bfe 100%);
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  box-shadow: 0 8px 20px rgba(77, 107, 254, .32);
}
.login-card h1 { font-size: 21px; font-weight: 650; text-align: center; letter-spacing: .2px; }
.login-sub { color: var(--text-3); text-align: center; margin: 6px 0 26px; font-size: 13px; }
.login-card .field { margin-bottom: 16px; }
.login-tip { margin-top: 18px; color: var(--text-3); font-size: 12px; text-align: center; }
.form-error {
  background: var(--danger-bg); color: var(--danger); border: 1px solid #ffd6d3;
  padding: 9px 13px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px;
}

/* ============================ 布局 ============================ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--card); border-right: 1px solid var(--border-2);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, #5b7cfa 0%, #4d6bfe 100%);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  box-shadow: 0 4px 10px rgba(77, 107, 254, .28);
}
.brand-text { font-size: 15.5px; font-weight: 650; letter-spacing: .2px; }
.nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: var(--radius);
  cursor: pointer; color: var(--text-2); font-weight: 500; font-size: 14px; transition: .16s; user-select: none;
}
.nav-item i { font-style: normal; width: 19px; text-align: center; font-size: 15px; opacity: .85; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active i { opacity: 1; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--border-2); }
.user-line { font-size: 13px; margin-bottom: 10px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.user-line span { font-weight: 500; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 62px; background: rgba(255, 255, 255, .86); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border-2); display: flex; align-items: center;
  justify-content: space-between; padding: 0 26px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17.5px; font-weight: 640; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.view { padding: 26px; max-width: 1240px; width: 100%; }

/* ============================ 卡片 ============================ */
.card {
  background: var(--card); border: 1px solid var(--border-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow: hidden;
}
.card.narrow { max-width: 480px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 17px 22px; border-bottom: 1px solid var(--border-2);
}
.card-head h2 { font-size: 15px; font-weight: 620; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.card-title-group { display: flex; flex-direction: column; gap: 2px; }
.head-actions { display: flex; gap: 9px; align-items: center; }
.card-body { padding: 22px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(184px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border-2); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 7px;
  transition: .18s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card .label { color: var(--text-3); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat-card .value { font-size: 25px; font-weight: 680; letter-spacing: -.3px; line-height: 1.2; }
.stat-card .sub { font-size: 12px; color: var(--text-3); }
.stat-card.ok .value { color: var(--success); }
.stat-card.warn .value { color: var(--warn); }
.stat-card.accent { background: linear-gradient(135deg, #f5f7ff 0%, #eef1fe 100%); border-color: #e2e8ff; }
.stat-card.accent .value { color: var(--primary); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 940px) { .two-col { grid-template-columns: 1fr; } }

.kv { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--text-3); }
.kv b { font-weight: 600; }

/* ============================ 表单 ============================ */
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; margin-bottom: 7px; color: var(--text-2); font-size: 13px; font-weight: 550; }
.field > span .req { color: var(--danger); margin-left: 2px; }
input[type=text], input[type=password], select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text); transition: .16s;
}
input::placeholder, textarea::placeholder { color: #c2c6cc; }
input:hover, select:hover, textarea:hover { border-color: #d3d6db; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(77, 107, 254, .12);
}
.field-hint { margin-top: 6px; color: var(--text-3); font-size: 12px; }
.check { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.check span { color: var(--text-2); font-size: 13.5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.input-row { display: flex; gap: 9px; }
.input-row input { flex: 1; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
fieldset { border: 1px solid var(--border-2); background: #fcfcfd; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
fieldset legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0 8px; }

/* 分段控制器（手动 / 定时） */
.seg { display: inline-flex; background: var(--border-2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg-item { position: relative; cursor: pointer; }
.seg-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-item span {
  display: block; padding: 7px 24px; border-radius: 9px; font-size: 14px;
  color: var(--text-2); font-weight: 500; transition: .16s; white-space: nowrap;
}
.seg-item:hover span { color: var(--text); }
.seg-item input:checked + span {
  background: #fff; color: var(--primary); font-weight: 620;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
}

/* 存在检查结果 */
.check-result { margin-top: 10px; font-size: 13px; min-height: 20px; display: flex; align-items: center; gap: 7px; }
.check-result .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.check-result.ok { color: var(--success); }
.check-result.ok .dot { background: var(--success); }
.check-result.err { color: var(--danger); }
.check-result.err .dot { background: var(--danger); }
.check-result.pending { color: var(--text-3); }
.check-result.pending .dot { background: var(--text-3); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* ============================ 按钮 ============================ */
.btn {
  padding: 9px 17px; border: 1px solid var(--border); background: #fff; color: var(--text-2);
  border-radius: var(--radius); cursor: pointer; font-size: 14px; font-weight: 550; font-family: inherit;
  transition: .16s; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { background: var(--bg); border-color: #d3d6db; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(77, 107, 254, .26); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-primary:active { background: var(--primary-active); }
.btn-danger { background: #fff; border-color: #ffd6d3; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: #ffc2be; color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-3); }
.btn-ghost:hover { background: var(--bg); color: var(--text-2); }
.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 17px; color: var(--text-3); width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; transition: .15s; }
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* ============================ 徽章 / 状态 ============================ */
.badge {
  padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 550;
  background: var(--bg); color: var(--text-2); border: 1px solid var(--border);
  display: inline-flex; align-items: center; gap: 5px;
}
.badge.ok { background: var(--success-bg); color: #0a7d24; border-color: #b7f5c0; }
.badge.err { background: var(--danger-bg); color: #cb272d; border-color: #ffc9c5; }
.badge.warn { background: var(--warn-bg); color: #b25a00; border-color: #ffe0b3; }
.badge.info { background: var(--primary-soft); color: var(--primary); border-color: #d6deff; }

.st { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.success { background: var(--success-bg); color: #0a7d24; }
.st.failed { background: var(--danger-bg); color: #cb272d; }
.st.partial { background: var(--warn-bg); color: #b25a00; }
.st.running { background: var(--primary-soft); color: var(--primary); }
.st.running::before { animation: pulse 1s infinite; }
.st.gray { background: var(--border-2); color: var(--text-3); }

.tag-pill { display: inline-block; padding: 2px 9px; margin: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; font-family: monospace; color: var(--text-2); }

/* ============================ 表格 ============================ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border-2); font-size: 13.5px; vertical-align: middle; }
.table th { color: var(--text-3); font-weight: 600; font-size: 12.5px; white-space: nowrap; background: #fafbfc; }
.table tbody tr { transition: .12s; }
.table tbody tr:hover { background: var(--primary-soft-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table td.mono { font-family: monospace; font-size: 12.5px; }
.ta-r { text-align: right !important; }
.row-actions { display: flex; gap: 7px; justify-content: flex-end; }
.empty { text-align: center; color: var(--text-3); padding: 52px 20px; }
.empty .big { font-size: 34px; display: block; margin-bottom: 10px; opacity: .5; }
.arrow { color: var(--text-3); }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 18px 0 4px; }
.pager span { color: var(--text-3); font-size: 13px; }

/* ============================ 私有仓库浏览 ============================ */
.ta-c { text-align: center !important; }
.repo-row { cursor: pointer; }
.repo-row .caret { display: inline-block; width: 15px; color: var(--text-3); font-size: 11px; }
.detail-row > td { background: #fafbfc; padding: 15px 20px !important; }
.detail-row:hover > td { background: #fafbfc; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 7px 5px 12px;
  background: #fff; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px;
}
.tag-chip .mono { color: var(--text); }
.copy-btn {
  background: var(--bg); border: none; cursor: pointer; color: var(--text-3);
  width: 22px; height: 22px; border-radius: 50%; font-size: 12px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; transition: .15s;
}
.copy-btn:hover { background: var(--primary-soft); color: var(--primary); }
.err-text { color: var(--danger); font-size: 13px; }

/* ============================ 弹窗 ============================ */
.modal {
  position: fixed; inset: 0; background: rgba(29, 33, 41, .42); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 100; overflow-y: auto;
}
.modal-card {
  background: #fff; border-radius: var(--radius-xl); width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.16, 1, .3, 1);
}
.modal-card.small { max-width: 460px; }
@keyframes pop { from { opacity: 0; transform: translateY(-14px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; }
.modal-head h2 { font-size: 16.5px; font-weight: 640; }
.modal-body { padding: 6px 24px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-2); }
.cron-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  padding: 5px 13px; border: 1px solid var(--border); border-radius: 999px; background: #fff;
  cursor: pointer; font-size: 12.5px; color: var(--text-2); transition: .15s; font-family: inherit;
}
.chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ============================ 日志详情 ============================ */
.log-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px 20px; margin-bottom: 16px; }
.log-meta > div { display: flex; flex-direction: column; gap: 3px; }
.log-meta .k { color: var(--text-3); font-size: 12px; }
.log-meta .v { color: var(--text); font-size: 13.5px; font-weight: 550; }
.log-detail {
  background: #1d2129; color: #e5e6eb; padding: 18px; border-radius: var(--radius); font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px; line-height: 1.75; white-space: pre-wrap; word-break: break-all; max-height: 460px; overflow-y: auto;
}

/* ============================ Toast ============================ */
#toast-wrap { position: fixed; top: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 250px; max-width: 380px; padding: 13px 17px; border-radius: var(--radius); color: #fff;
  box-shadow: var(--shadow-md); font-size: 13.5px; font-weight: 500; animation: slide .24s cubic-bezier(.16, 1, .3, 1);
  display: flex; gap: 8px; align-items: flex-start;
}
@keyframes slide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
.toast.warn { background: var(--warn); }

.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ 响应式 ============================ */
@media (max-width: 860px) {
  :root { --sidebar-w: 66px; }
  .brand-text, .nav-item span, .user-line span, .sidebar-footer .btn span { display: none; }
  .brand { justify-content: center; padding: 20px 0; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .nav-item i { width: auto; }
  .user-line { justify-content: center; }
  .grid-2 { grid-template-columns: 1fr; }
  .view { padding: 18px; }
  .topbar { padding: 0 18px; }
}
