:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --sidebar: #111827;
  --ok: #059669;
  --bad: #dc2626;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

body.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--sidebar);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; margin-bottom: 22px; }
.logo {
  width: 28px; height: 28px; flex: 0 0 28px;
  display: block; border-radius: 0; background: none;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  color: #cbd5e1; text-decoration: none; padding: 9px 12px; border-radius: 8px;
}
.sidebar nav a:hover { background: #1f2937; color: #fff; }
.sidebar nav a.active { background: #1d4ed8; color: #fff; }
.main { flex: 1; padding: 22px 26px 40px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar h1 { font-size: 20px; margin: 0; }
.who { color: var(--muted); font-size: 13px; }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) {
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
}

.card, .panel-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.card-title { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.big { font-size: 26px; font-weight: 700; line-height: 1.2; }
.big.small { font-size: 18px; margin-top: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sub { margin-top: 8px; color: var(--muted); font-size: 12px; }

.bar { height: 8px; background: #eef2f7; border-radius: 99px; margin-top: 12px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, #6366f1); border-radius: 99px; }

table.kv { width: 100%; border-collapse: collapse; }
table.kv th, table.kv td { text-align: left; padding: 9px 4px; border-bottom: 1px solid var(--line); font-weight: 400; }
table.kv th { color: var(--muted); width: 40%; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; }
.badge.ok { background: #d1fae5; color: var(--ok); }
.badge.bad { background: #fee2e2; color: var(--bad); }

.flash { padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; font-size: 13px; }
.flash.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.flash.success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

/* auth */
body.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, #0f172a, #1e293b 60%, #1e3a8a); }
.auth-wrap { width: 100%; max-width: 380px; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 30px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.login-brand { display: flex; justify-content: center; margin-bottom: 10px; }
.login-brand .logo { width: 44px; height: 44px; flex: 0 0 44px; }
.login-card h2 { text-align: center; margin: 0 0 4px; font-size: 20px; }
.login-card .muted { text-align: center; margin: 0 0 18px; }
.login-card label { display: block; margin: 12px 0 6px; font-size: 13px; color: #374151; }
.login-card input, .panel-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; outline: none; background: #fff;
}
.login-card input:focus, .panel-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.panel-card { max-width: 460px; }
.panel-card h2 { margin-top: 0; font-size: 18px; }
.panel-card label { display: block; margin: 12px 0 6px; font-size: 13px; color: #374151; }

.btn { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; border: 0; border-radius: 9px; padding: 10px 16px; font-size: 14px; line-height: 1.15; cursor: pointer; margin-top: 16px; text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; width: 100%; }
.btn.primary:hover { background: var(--brand-dark); }

/* ---------- mobile first ---------- */
.hamburger, .scrim { display: none; }

@media (max-width: 820px) {
  body.app { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 264px; height: 100%;
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 60;
    box-shadow: 20px 0 50px rgba(0, 0, 0, .25);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim {
    display: block; position: fixed; inset: 0;
    background: rgba(15, 23, 42, .55);
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
    z-index: 55;
  }
  .scrim.show { opacity: 1; pointer-events: auto; }

  .main { padding: 10px 14px calc(88px + env(safe-area-inset-bottom)); }
  .topbar {
    position: sticky; top: 0; z-index: 30;
    background: var(--bg);
    margin: -10px -14px 12px;
    padding: 10px 14px;
    gap: 10px;
    border-bottom: 1px solid rgba(229, 231, 235, .7);
  }
  .topbar h1 { font-size: 17px; flex: 1; }
  .hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    border: 1px solid var(--line); border-radius: 10px;
    background: #fff; font-size: 18px; color: var(--ink);
    flex: 0 0 auto;
  }

  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.two { grid-template-columns: 1fr; gap: 10px; }
  .card, .panel-card { padding: 13px 14px; border-radius: 12px; }
  .big { font-size: 21px; }
  .big.small { font-size: 16px; }
  .card-title { font-size: 12px; }
  .muted, .sub { font-size: 11.5px; }
  table.kv th, table.kv td { padding: 8px 2px; font-size: 13px; }
  table.kv td { word-break: break-word; overflow-wrap: anywhere; }
  table.kv th { width: 38%; }

  .hamburger svg { width: 20px; height: 20px; display: block; }

  .flash { margin-bottom: 10px; }
  .login-card { padding: 24px 20px; }
  .login-card input, .panel-card input { font-size: 16px; }
  .btn { padding: 12px 16px; }
}
@media (max-width: 380px) {
  .grid.cards { grid-template-columns: 1fr; }
}

/* ---------- files ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text] {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; min-width: 180px; outline: none;
}
.inline-form input[type=text]:focus { border-color: var(--brand); }
.inline-form input[type=file] { font-size: 13px; max-width: 200px; }
.toolbar .btn { width: auto; }
.btn.small { height: 32px; padding: 0 14px; margin-top: 0; font-size: 13px; }
.btn.ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; word-break: break-all; }
.crumbs a { color: var(--brand); text-decoration: none; }

.file-list { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); min-height: 58px; }
.file-row:last-child { border-bottom: 0; }
.file-ico {
  width: 36px; height: 36px; border-radius: 9px; background: #eef2ff;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto; font-size: 18px;
}
.file-ico.dir { background: #fff7ed; }
.file-main { flex: 1; min-width: 0; }
.file-name { font-weight: 500; color: var(--ink); text-decoration: none; word-break: break-all; }
a.file-name:hover { color: var(--brand); }
.file-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.file-actions { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.file-actions form { margin: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font-size: 12.5px;
  text-decoration: none; cursor: pointer;
}
.icon-btn.danger { color: var(--bad); border-color: #fecaca; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.panel-card.wide { max-width: 100%; }
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.code-editor {
  width: 100%; min-height: 55vh; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.55; resize: vertical;
}

@media (max-width: 820px) {
  .toolbar { flex-direction: column; }
  .inline-form { width: 100%; }
  .inline-form input[type=text] { flex: 1; min-width: 0; }
  .inline-form input[type=file] { flex: 1; max-width: none; }
  .file-actions .icon-btn { min-height: 40px; padding: 0 12px; }
  .code-editor { min-height: 60vh; font-size: 14px; }
}

/* ---------- file icons / picker / fab ---------- */
.file-ico svg { width: 20px; height: 20px; }
.file-ico.dir { background: #fff7ed; color: #ea580c; }
.file-ico.code { background: #eef2ff; color: #4f46e5; }
.file-ico.image { background: #ecfdf5; color: #059669; }
.file-ico.file { background: #f1f5f9; color: #475569; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 5px; background: #f1f5f9; color: #64748b; font-size: 10.5px; }
.file-pick { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.file-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.pick-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #f8fafc; font-size: 13px; white-space: nowrap;
}
.pick-name { font-size: 12px; color: var(--muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fab { display: none; }
.sheet { display: none; }
.sheet.open { display: block; }
.sheet-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 70; }
.sheet-body {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 71; background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(22px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 15px; }
.sheet-close { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); padding: 0 4px; }
.sheet-form { margin: 0 0 14px; }
.sheet-form:last-child { margin-bottom: 0; }
.sheet-label { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.sheet-row { display: flex; gap: 8px; }
.sheet-row input { flex: 1; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 16px; }
.sheet-form .file-pick { display: flex; margin-bottom: 10px; }
.sheet-form .pick-btn { min-height: 44px; flex: 0 0 auto; }
.sheet-form .btn { width: 100%; }
.sheet-row .btn { width: auto; flex: 0 0 auto; }

@media (max-width: 820px) {
  .toolbar { display: none; }
  .fab {
    display: flex; position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 45; width: 54px; height: 54px; border-radius: 50%; border: 0;
    background: var(--brand); color: #fff;
    align-items: center; justify-content: center;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .42);
  }
  .fab svg { width: 26px; height: 26px; }
  .file-row { padding: 12px; }
}

/* ---------- progress ---------- */
#progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 200; pointer-events: none; }
#progress .bar { height: 100%; width: 0; background: var(--brand); opacity: 0; transition: width .2s ease, opacity .2s ease; }
#progress.on .bar { opacity: 1; width: 72%; transition: width 6s cubic-bezier(.1, .65, .25, 1); }
#progress.done .bar { width: 100%; opacity: 0; transition: width .18s ease, opacity .35s ease .08s; }

/* ---------- view transition / loading ---------- */
.view { transition: opacity .18s ease; }
.view.is-loading { opacity: .55; pointer-events: none; }
::view-transition-old(root) { animation: vt-out .12s ease both; }
::view-transition-new(root) { animation: vt-in .22s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(15, 23, 42, .55);
  opacity: 0; transition: opacity .2s ease;
}
.modal.show { opacity: 1; }
.modal[hidden] { display: none; }
.modal-card {
  width: 100%; max-width: 860px; max-height: 92dvh;
  background: #fff; border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(28px); transition: transform .26s cubic-bezier(.2, .8, .3, 1);
  box-shadow: 0 -20px 60px rgba(2, 6, 23, .3);
}
.modal.show .modal-card { transform: none; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.modal-title { font-weight: 600; font-size: 15px; }
.modal-close {
  width: 40px; height: 40px; border: 0; background: #f1f5f9; border-radius: 6px;
  font-size: 22px; line-height: 1; color: #475569; cursor: pointer;
}
.modal-body { padding: 16px; overflow: auto; -webkit-overflow-scrolling: touch; }
.editor-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.editor-meta .file-name { font-size: 14px; }
.editor-form { display: flex; flex-direction: column; min-height: 0; }
.modal .code-editor { min-height: 52dvh; max-height: 60dvh; }
.editor-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 12px; position: sticky; bottom: -16px; background: #fff;
  padding-bottom: 4px; margin-bottom: -4px;
}
.editor-actions .btn { width: auto; margin-top: 0; min-width: 120px; }
.btn.loading { opacity: .65; pointer-events: none; }

@media (min-width: 821px) {
  .modal { align-items: center; padding: 24px; }
  .modal-card { border-radius: 16px; max-height: 86vh; }
  .modal .code-editor { min-height: 56vh; max-height: 62vh; }
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 300;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(92vw, 420px);
}
.toast {
  max-width: 100%; padding: 10px 16px; border-radius: 10px;
  background: #111827; color: #fff; font-size: 13px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, .28);
  opacity: 0; transform: translateY(10px); transition: all .22s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }

@media (max-width: 820px) {
  .modal .code-editor { min-height: 46dvh; max-height: 52dvh; }
  .modal-body { padding: 14px; }
  .editor-actions .btn { flex: 0 0 auto; }
  .kbd-hint { display: none; }
}

@media (max-width: 820px) and (max-height: 600px) {
  .modal .code-editor { min-height: 30dvh; max-height: 38dvh; }
}

/* ---------- file tree ---------- */
.tree-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 2px 8px; }
.tree-tools { display: flex; gap: 4px; flex: 0 0 auto; }
.tree-tools .icon-btn { font-size: 12px; padding: 4px 8px; border-radius: 7px; border: 1px solid var(--line); background: #fff; }
.tree { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 5px; overflow: hidden; }
.tree-item { position: relative; }
.tree-row { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 8px 4px 4px; border-radius: 8px; }
.tree-row:hover { background: #f8fafc; }
.tree-chev {
  flex: 0 0 auto; width: 22px; height: 22px; border: 0; background: none; padding: 0;
  display: flex; align-items: center; justify-content: center; color: #94a3b8;
  cursor: pointer; border-radius: 5px;
}
.tree-chev:hover { background: #eef2f7; color: #475569; }
.tree-chev svg { width: 13px; height: 13px; transition: transform .18s ease; }
.tree-item.open > .tree-row .tree-chev svg { transform: rotate(90deg); }
.tree-chev.empty { opacity: 0; pointer-events: none; }
.tree-ico { flex: 0 0 auto; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; color: #64748b; }
.tree-ico svg { width: 17px; height: 17px; }
.tree-ico.dir { color: #f59e0b; }
.tree-ico.code { color: #6366f1; }
.tree-ico.image { color: #10b981; }
.tree-label {
  flex: 1 1 auto; min-width: 0; font-size: 13.5px; color: var(--ink);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree-label:hover { color: var(--brand); }
.tree-label.protected { color: #94a3b8; }
.tree-meta { flex: 0 0 auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tree-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity .15s; }
.tree-row:hover .tree-actions, .tree-row:focus-within .tree-actions { opacity: 1; }
.tree-actions .icon-btn {
  border: 0; background: none; color: var(--muted); font-size: 11.5px;
  padding: 3px 6px; min-height: 26px; border-radius: 6px;
}
.tree-actions .icon-btn:hover { background: #eef2f7; color: var(--ink); }
.tree-actions .icon-btn.danger:hover { background: #fef2f2; color: var(--bad); }
.tree-children { margin-left: 15px; border-left: 1px solid #eef2f7; padding-left: 2px; }
.tree-skeleton { padding: 6px 4px; }
.sk-row {
  height: 30px; border-radius: 6px; margin-bottom: 6px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e8eef6 37%, #f1f5f9 63%);
  background-size: 400% 100%; animation: sk 1.3s ease infinite;
}
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.tree .empty { padding: 22px 10px; text-align: center; color: var(--muted); font-size: 13px; }
.tree-error { color: var(--bad); }

@media (max-width: 820px) {
  .toolbar { display: none; }
  .tree { border-radius: 14px; padding: 4px; }
  .tree-row { min-height: 44px; padding: 4px 6px; gap: 5px; }
  .tree-meta { font-size: 10.5px; }
  .tree-actions { opacity: 1; }
  .tree-actions .icon-btn { min-height: 34px; padding: 0 6px; }
  .tree-tools .icon-btn { min-height: 34px; }
  .tree-head { align-items: flex-start; }
  .tree-head .crumbs { flex: 1 1 auto; min-width: 0; }
}

/* ---------- file list v2 ---------- */
.file-toolbar { display: flex; gap: 8px; margin: 2px 0 10px; align-items: center; }
.file-toolbar .btn {
  width: auto; margin: 0; height: 38px; padding: 0 14px;
  display: inline-flex; align-items: center; gap: 6px;
  justify-content: center;
}
.file-toolbar .btn svg { width: 16px; height: 16px; }
.file-toolbar .btn.primary { margin-left: auto; }
.file-list { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.file-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  min-height: 62px; border-bottom: 1px solid #f1f5f9; cursor: pointer;
  transition: background .12s ease;
}
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: #f8fafc; }
.file-row:active { background: #f1f5f9; }
.file-row:focus-visible { outline: 2px solid rgba(37, 99, 235, .45); outline-offset: -2px; }
.file-row.is-cut { opacity: .55; filter: grayscale(1); background: #fafafa; cursor: default; }
.file-row.is-cut:hover { background: #fafafa; }
.file-row.is-cut .file-name { color: #94a3b8; }
.cut-tag {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px;
  background: #e2e8f0; color: #475569; font-size: 11px; font-weight: 600;
  font-style: normal; vertical-align: 1px;
}
.file-ico { width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; }
.file-ico svg { width: 20px; height: 20px; }
.file-name {
  font-size: 14px; font-weight: 500; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-meta {
  font-size: 11.5px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.more-btn {
  width: 38px; height: 38px; flex: 0 0 auto; border: 0; background: none;
  border-radius: 10px; color: #94a3b8; display: flex; align-items: center;
  justify-content: center; cursor: pointer;
}
.more-btn:hover { background: #f1f5f9; color: #475569; }
.more-btn svg { width: 18px; height: 18px; }
.file-list .empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 44px 20px; }
.file-list .empty svg { width: 34px; height: 34px; color: #cbd5e1; }

/* ---------- file menu ---------- */
.file-menu {
  position: fixed; z-index: 150; min-width: 196px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(2, 6, 23, .18); padding: 6px;
  opacity: 0; transform: translateY(6px) scale(.98);
  transition: opacity .16s ease, transform .16s ease;
}
.file-menu.show { opacity: 1; transform: none; }
.file-menu .menu-title {
  font-size: 11px; color: var(--muted); padding: 6px 10px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-menu button {
  display: flex; width: 100%; align-items: center; padding: 10px;
  border: 0; background: none; border-radius: 8px;
  font-size: 13.5px; color: var(--ink); text-align: left; cursor: pointer;
}
.file-menu button:hover { background: #f4f7fb; }
.file-menu button.danger { color: var(--bad); }
.file-menu button.danger:hover { background: #fef2f2; }
.file-menu button:disabled { color: #cbd5e1; cursor: default; }
.file-menu .menu-cancel { display: none; }

/* ---------- prompt ---------- */
.prompt-mask {
  position: fixed; inset: 0; z-index: 160; background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center; padding: 22px;
  opacity: 0; transition: opacity .18s ease;
}
.prompt-mask.show { opacity: 1; }
.prompt-card {
  width: 100%; max-width: 360px; background: #fff; border-radius: 16px;
  padding: 20px; box-shadow: 0 24px 70px rgba(2, 6, 23, .3);
  transform: translateY(10px) scale(.98); transition: transform .2s ease;
}
.prompt-mask.show .prompt-card { transform: none; }
.prompt-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.prompt-hint { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.prompt-input {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; outline: none; box-sizing: border-box;
}
.prompt-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.prompt-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.prompt-actions .btn { width: auto; margin: 0; min-width: 76px; }
.choice-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.choice-actions .btn { width: 100%; margin: 0; height: 42px; }
.choice-actions .btn.danger { background: #ef4444; border-color: #ef4444; color: #fff; }
.choice-actions .btn.danger:hover { background: #dc2626; }
.choice-actions .btn.ghost { background: #fff; color: var(--muted); border-color: var(--line); }

#view.swap-in { animation: viewIn .2s ease; }
@keyframes viewIn { from { opacity: .55; } to { opacity: 1; } }

/* ---------- editor modal ---------- */
.modal-card {
  width: min(88vw, 900px); height: auto;
  aspect-ratio: 4 / 3;
  max-width: calc(88vh * 4 / 3);
  max-height: 88vh;
}
.modal-head-actions { display: flex; align-items: center; gap: 8px; }
.modal-save {
  width: auto; margin: 0; min-width: 72px; height: 32px;
  padding: 0 16px; font-size: 13px; border-radius: 8px;
}
.modal-save[hidden] { display: none; }
.modal-body { padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.modal .editor-form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.editor-file {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: #fff; flex: 0 0 auto;
}
.editor-ext {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 26px; padding: 0 6px; border-radius: 6px;
  background: #eef2ff; color: #4f46e5; font-size: 10.5px; font-weight: 700;
  letter-spacing: .4px;
}
.editor-file-main { min-width: 0; }
.editor-name {
  font-size: 14px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.editor-sub {
  font-size: 11px; color: var(--muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.editor-shell { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.line-numbers {
  flex: 0 0 auto; width: 46px; padding: 12px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 20px; text-align: right; color: #94a3b8;
  background: #f8fafc; border-right: 1px solid var(--line);
  overflow: hidden; white-space: pre; user-select: none;
}
.modal .code-editor {
  flex: 1; width: auto; height: 100%; min-height: 0; max-height: none;
  padding: 12px; border: 0; border-radius: 0; resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 20px; white-space: pre; overflow: auto;
  outline: none; background: #fff;
}
.editor-status {
  display: flex; align-items: center; gap: 12px; padding: 6px 12px;
  font-size: 11px; color: var(--muted); border-top: 1px solid var(--line);
  background: #fbfdff; flex: 0 0 auto;
}
.editor-dirty { color: #b45309; margin-left: auto; }
.editor-actions {
  display: flex; justify-content: flex-end; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--line); background: #fff; flex: 0 0 auto;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.editor-actions .btn { width: auto; margin: 0; min-width: 96px; }

@media (max-width: 820px) {
  .file-toolbar .btn { flex: 1 1 0; height: 40px; font-size: 12.5px; padding: 0 8px; }
  .file-toolbar .btn.primary { margin-left: 0; }
  .file-toolbar .btn svg { width: 15px; height: 15px; }
  .file-row { min-height: 66px; padding: 12px; gap: 10px; }
  .file-name { font-size: 15px; }
  .more-btn { width: 40px; height: 40px; }
  .file-menu {
    left: 10px; right: 10px; top: auto !important;
    bottom: calc(10px + env(safe-area-inset-bottom));
    min-width: 0; border-radius: 16px; padding: 8px;
    transform: translateY(14px);
  }
  .file-menu button { padding: 14px 12px; font-size: 15px; }
  .file-menu button + button { border-top: 1px solid #f5f7fb; }
  .file-menu .menu-cancel {
    display: flex; justify-content: center; margin-top: 6px;
    padding: 14px 12px; color: var(--muted);
    border-top: 1px solid #eef2f7; border-radius: 0;
  }
  .file-menu .menu-title { padding: 8px 12px 6px; }
  .modal { align-items: stretch; padding: 0; height: 100%; background: #fff; }
  .modal-card {
    width: 100%; max-width: none; height: 100%; max-height: 100%;
    aspect-ratio: auto; border-radius: 0;
  }
  .modal-head { padding-top: 10px; }
  .editor-status { padding-bottom: 6px; }
  .modal .code-editor { font-size: 13px; }
  .line-numbers { width: 42px; }
}

/* ---------- toolbar v2 / batch selection ---------- */
.file-toolbar[hidden], .batch-bar[hidden], .tool-btn[hidden] { display: none !important; }
.file-actions {
  position: sticky; top: 0; z-index: 20; display: block;
  background: var(--bg); padding: 4px 0 8px; margin: -4px 0 2px;
}
.file-toolbar { display: flex; gap: 6px; margin: 0; align-items: center; }
.tool-btn {
  height: 32px; padding: 0 10px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center;
  gap: 4px; color: var(--ink); cursor: pointer; white-space: nowrap;
  font-family: inherit; transition: background .12s ease, border-color .12s ease;
}
.tool-btn svg { width: 14px; height: 14px; }
.tool-btn:hover { background: #f8fafc; }
.tool-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.tool-btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.tool-btn.danger { color: var(--bad); border-color: #fecaca; }
.tool-btn.danger:hover { background: #fef2f2; }
.tool-btn:disabled { opacity: .45; pointer-events: none; }
.batch-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.batch-bar #batchCount { margin-right: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.batch-mode .file-row { position: relative; padding-left: 46px; }
.batch-mode .file-row::before {
  content: ''; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #c3cddd;
  background: #fff; box-sizing: border-box; left: 15px;
}
.batch-mode .file-row.selected { background: #eff6ff; }
.batch-mode .file-row.selected::before { background: var(--brand); border-color: var(--brand); }
.batch-mode .file-row.selected::after {
  content: ''; position: absolute; left: 21px; top: calc(50% - 4.5px);
  width: 5px; height: 9px; border: 0;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}
.batch-mode .more-btn { display: none; }

.modal-head { position: relative; z-index: 3; flex: 0 0 auto; }
.modal-head .modal-close {
  width: 32px; height: 32px; flex: 0 0 32px; box-sizing: border-box;
  border-radius: 6px; background: #ef4444; color: #fff;
  border: 0; display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; padding: 0; cursor: pointer;
  box-shadow: 0 3px 10px rgba(239, 68, 68, .35);
}
.modal-close:hover { background: #dc2626; color: #fff; }

@media (max-width: 820px) {
  .file-actions { top: 59px; }
  .tool-btn { height: 34px; font-size: 13px; padding: 0 11px; }
  .batch-mode .file-row { padding-left: 48px; }
}

/* ---------- sites ---------- */
.sites-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sites-count { font-size: 14px; color: var(--muted); line-height: 1.4; white-space: nowrap; }
.sites-count strong { color: var(--ink); font-size: 18px; }
.sites-head .btn { width: auto; flex: 0 0 auto; margin-top: 0; }
.sites-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.site-card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; text-decoration: none; color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.site-card:hover { border-color: #c7d2fe; box-shadow: 0 8px 24px rgba(15, 23, 42, .06); }
.site-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.site-domain { font-weight: 650; font-size: 15px; word-break: break-all; }
.site-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.site-state i { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; display: inline-block; }
.site-state.running { color: #047857; }
.site-state.running i { background: #10b981; }
.site-state.pending { color: #6d28d9; }
.site-state.pending i { background: #8b5cf6; }
.site-state.error { color: #b91c1c; }
.site-state.error i { background: #ef4444; }
.site-state.paused { color: #a16207; }
.site-state.paused i { background: #eab308; }
.site-path {
  margin-top: 6px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px; color: var(--muted); word-break: break-all;
}
.site-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 11.5px;
}
.chip.ok { background: #ecfdf5; color: #047857; }
.chip.warn { background: #fffbeb; color: #b45309; }
.chip.bad { background: #fef2f2; color: #b91c1c; }
.chip.ghost { background: #f8fafc; color: #94a3b8; }
.site-alias { margin-top: 8px; font-size: 12px; color: var(--brand); }

.empty-state { background: var(--card); border: 1px dashed #cbd5e1; border-radius: 16px; padding: 48px 20px; text-align: center; }
.empty-ico {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px;
  background: #eff6ff; color: var(--brand); display: flex; align-items: center; justify-content: center;
}
.empty-ico svg { width: 26px; height: 26px; }
.empty-state h3 { margin: 0 0 6px; font-size: 16px; }

.back-link { display: inline-block; margin-bottom: 12px; color: var(--muted); text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--brand); }

.site-form { display: flex; flex-direction: column; gap: 18px; padding: 20px; }
.form-row { display: flex; flex-direction: column; gap: 7px; }
.lbl { font-size: 13px; font-weight: 600; color: #374151; }
.site-form textarea, .site-form input, .inline-form input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 16px; font-family: inherit; background: #fff; color: var(--ink); outline: none;
}
.site-form textarea:focus, .site-form input:focus, .inline-form input:focus {
  border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.site-form input[readonly] { background: #f8fafc; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.inline-input { display: flex; gap: 8px; }
.inline-input input { flex: 1; }
.seg { display: inline-flex; background: #f1f5f9; border-radius: 10px; padding: 3px; gap: 2px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; padding: 7px 14px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.seg input:checked + span { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.form-note {
  display: flex; gap: 8px; align-items: flex-start; background: #f8fafc;
  border-radius: 10px; padding: 10px 12px; color: var(--muted); font-size: 12.5px; line-height: 1.5;
}
.form-note svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }

.site-hero { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px; margin-bottom: 12px; }
.site-hero h2 { margin: 0 0 4px; font-size: 19px; word-break: break-all; }
.site-hero .site-path { margin-top: 0; }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; cursor: pointer; }
.slider::before {
  content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + .slider { background: #10b981; }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch.small { width: 40px; height: 23px; }
.switch.small .slider::before { width: 17px; height: 17px; }
.switch.small input:checked + .slider::before { transform: translateX(17px); }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab {
  border: 0; background: transparent; padding: 10px 12px; font-size: 13.5px;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap; font-family: inherit;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel .card { padding: 16px; }
.panel-title { font-weight: 650; margin-bottom: 10px; }
.mini-link { margin-left: 8px; font-size: 12px; color: var(--brand); text-decoration: none; }
.quick-actions { display: flex; gap: 8px; margin-top: 10px; }

.domain-list { display: flex; flex-direction: column; }
.domain-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.domain-row:last-child { border-bottom: 0; }
.domain-name { word-break: break-all; }
.domain-info { min-width: 0; }
.dns-line { margin-top: 4px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.dns-badge { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.dns-badge.ok { color: #047857; }
.dns-badge.warn, .dns-badge.missing, .dns-badge.wrong, .dns-badge.proxied, .dns-badge.cname { color: #b45309; }
.dns-badge.bad, .dns-badge.external, .dns-badge.unknown { color: #b91c1c; }
.link-btn {
  border: 0; background: none; padding: 0; margin-left: 2px;
  color: var(--brand); font-size: 12px; cursor: pointer; font-family: inherit;
}
.link-btn:disabled { opacity: .5; }
.tag {
  font-style: normal; font-size: 10.5px; background: #eff6ff; color: var(--brand);
  padding: 1px 6px; border-radius: 999px; margin-left: 6px; vertical-align: 1px;
}
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form input { flex: 1; }
.inline-form .btn { margin-top: 0; flex: 0 0 auto; }

.log-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.seg.small { padding: 2px; }
.seg.small button {
  border: 0; background: transparent; border-radius: 7px; color: var(--muted);
  padding: 5px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.seg.small button.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.log-box {
  margin: 0; background: #0b1220; color: #cbd5e1; border-radius: 10px; padding: 12px;
  font-size: 11.5px; line-height: 1.55; max-height: 52vh; overflow: auto;
  white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.danger-zone { margin-top: 16px; padding: 16px; border-color: #fecaca; }
.danger-zone .panel-title { color: var(--bad); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 10px 0 4px; }

@media (max-width: 820px) {
  .sites-grid { grid-template-columns: 1fr; }
  .site-form { padding: 16px; }
  .site-hero { padding: 16px; }
  .tab-panel .card { padding: 14px; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1; }
  .site-form .form-actions { position: sticky; bottom: 0; background: #fff; padding-top: 10px; }
}

/* ---------- settings ---------- */
.settings-page { display: flex; flex-direction: column; gap: 12px; }
.settings-card { padding: 16px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.settings-card .panel-title { margin: 0; }
.settings-card .form-row { margin-top: 12px; }
.check-list { margin-top: 10px; }
.check-row { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid #eef0f3; align-items: flex-start; }
.check-row:first-child { border-top: 0; }
.check-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 8px; background: #cbd5e1; }
.check-row.ok .check-dot { background: #10b981; }
.check-row.bad .check-dot { background: #ef4444; }
.check-text { min-width: 0; }
.check-text strong { font-size: 13.5px; font-weight: 650; }
.check-text .hint { margin-top: 2px; }
.steps { margin: 8px 0 10px; padding-left: 18px; color: #334155; font-size: 13px; line-height: 1.9; }
@media (max-width: 820px) { .settings-card { padding: 14px; } }
.dns-guide { margin-top: 6px; padding: 8px 10px; background: #f8fafc; border: 1px dashed #dbe2ea; border-radius: 8px; font-size: 11.5px; color: #475569; line-height: 1.6; word-break: break-all; }
.dns-guide { word-break: normal; overflow-wrap: anywhere; }
.dns-guide .nowrap { white-space: nowrap; }
.chip.violet { background: #f3e8ff; color: #6d28d9; }
.chip.amber { background: #fef3c7; color: #a16207; }

/* 服务管理 */
.svc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 6px; }
.svc-title { font-size: 20px; font-weight: 700; }
.svc-summary { font-size: 12px; margin-top: 4px; }
.svc-badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.svc-badge.ok { background: #ecfdf5; color: #047857; }
.svc-badge.bad { background: #fef2f2; color: #b91c1c; }
.svc-group { margin-top: 18px; }
.svc-group-title { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; margin: 0 0 8px 2px; }
.svc-list { display: grid; gap: 10px; }
.svc-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.svc-row { display: flex; gap: 10px; align-items: flex-start; }
.svc-dot { width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; margin-top: 6px; flex: 0 0 auto; }
.state-running .svc-dot { background: #10b981; box-shadow: 0 0 0 3px #d1fae5; }
.state-error .svc-dot, .state-stopped .svc-dot { background: #ef4444; box-shadow: 0 0 0 3px #fee2e2; }
.state-starting .svc-dot { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.svc-name { font-size: 15px; font-weight: 600; line-height: 1.3; }
.svc-ver { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.svc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.svc-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.svc-actions { display: flex; gap: 8px; margin-top: 12px; }
.svc-actions .btn { flex: 1; text-align: center; margin-top: 0; }
.btn.primary-line { background: #eff6ff; color: #1d4ed8; border: 1px solid #dbeafe; }
.svc-sheet { position: fixed; inset: 0; z-index: 90; }
.svc-sheet-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.svc-sheet-card { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 16px 16px 0 0; max-height: 72vh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.svc-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.svc-sheet-close { border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--muted); padding: 0 4px; }
.svc-log { margin: 0; padding: 14px 16px; overflow: auto; flex: 1; font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: #334155; background: #f8fafc; }

/* 概览 */
.ov-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ov-title { font-size: 20px; font-weight: 700; }
.ov-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.ov-badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.ov-badge.ok { background: #ecfdf5; color: #047857; }
.ov-badge.warn { background: #fffbeb; color: #a16207; }
.ov-badge.bad { background: #fef2f2; color: #b91c1c; }
.ov-issues { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.ov-issues-head { padding: 11px 14px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.ov-issue { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid #f1f5f9; color: var(--ink); text-decoration: none; font-size: 13px; }
.ov-issue:last-child { border-bottom: 0; }
.ov-issue-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.ov-issue.bad .ov-issue-dot { background: #ef4444; }
.ov-issue.warn .ov-issue-dot { background: #f59e0b; }
.ov-issue-tag { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: #f1f5f9; color: #475569; flex: 0 0 auto; }
.ov-issue-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-issue-arrow { color: #cbd5e1; }
.ov-clear { display: flex; align-items: center; gap: 12px; padding: 16px 14px; background: #f0fdf4; border-color: #bbf7d0; }
.ov-clear-icon { width: 28px; height: 28px; border-radius: 50%; background: #10b981; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; flex: 0 0 auto; }
.ov-clear-title { font-weight: 600; font-size: 14px; color: #047857; }
.ov-clear-sub { font-size: 12px; color: #059669; margin-top: 2px; }
.ov-link { float: right; font-size: 12px; font-weight: 400; color: var(--brand); text-decoration: none; }
.ov-svc-list { display: grid; gap: 2px; margin-top: 4px; }
.ov-svc { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid #f1f5f9; color: var(--ink); text-decoration: none; font-size: 13px; }
.ov-svc:last-child { border-bottom: 0; }
.ov-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex: 0 0 auto; }
.ov-dot.running { background: #10b981; }
.ov-dot.error, .ov-dot.stopped { background: #ef4444; }
.ov-dot.starting { background: #f59e0b; }
.ov-svc-name { flex: 1; }
.ov-svc-state { font-size: 12px; color: var(--muted); }
.ov-site-stats { display: flex; gap: 22px; margin-top: 10px; }
.ov-site-stats div { display: flex; flex-direction: column; gap: 2px; }
.ov-site-stats strong { font-size: 20px; }
.ov-site-stats span { font-size: 11px; color: var(--muted); }
.ov-site-stats .ok { color: #047857; }
.ov-site-stats .bad { color: #b91c1c; }
.ov-site-list { margin-top: 10px; border-top: 1px solid #f1f5f9; }
.ov-site-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; text-decoration: none; color: var(--ink); font-size: 13px; }
.ov-site-domain { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-site-tag { font-size: 11px; padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.ov-site-tag.error { background: #fef2f2; color: #b91c1c; }
.ov-site-tag.pending { background: #f5f3ff; color: #6d28d9; }
.ov-site-tag.paused { background: #fefce8; color: #a16207; }
.ov-site-tag.running { background: #ecfdf5; color: #047857; }

/* 服务 tab */
.svc-tabs { display: flex; gap: 4px; margin: 14px 0 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.svc-tab { flex: 0 0 auto; padding: 7px 13px; border-radius: 999px; font-size: 13px; color: var(--muted); text-decoration: none; background: #fff; border: 1px solid var(--line); }
.svc-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.svc-panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-top: 12px; overflow: hidden; }
.svc-empty { padding: 18px 14px; font-size: 13px; color: var(--muted); }

/* 进程 */
.proc-list { display: grid; }
.proc-row { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-bottom: 1px solid #f1f5f9; }
.proc-row:last-child { border-bottom: 0; }
.proc-main { flex: 1; min-width: 0; }
.proc-name { font-size: 13px; font-weight: 600; }
.proc-pid { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.proc-cmd { font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proc-nums { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: 0 0 auto; }
.proc-nums strong { font-size: 13px; color: #b45309; }
.proc-nums span { font-size: 11px; color: var(--muted); }

/* 端口 */
.port-list { display: grid; }
.port-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid #f1f5f9; }
.port-row:last-child { border-bottom: 0; }
.port-num { width: 58px; flex: 0 0 auto; font-size: 15px; font-weight: 700; color: #1d4ed8; }
.port-main { min-width: 0; }
.port-addr { font-size: 13px; }
.port-proc { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* 操作记录 */
.audit-list { display: grid; }
.audit-row { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; }
.audit-row:last-child { border-bottom: 0; }
.audit-top { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.audit-svc { font-weight: 600; }
.audit-act { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: #f1f5f9; color: #475569; }
.audit-res { margin-left: auto; font-size: 11px; padding: 2px 7px; border-radius: 6px; }
.audit-res.ok { background: #ecfdf5; color: #047857; }
.audit-res.bad { background: #fef2f2; color: #b91c1c; }
.audit-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.proc-head { display: flex; justify-content: space-between; padding: 8px 14px; font-size: 11px; color: var(--muted); background: #f8fafc; border-bottom: 1px solid #f1f5f9; }
.proc-nums { min-width: 66px; }
.proc-nums span { white-space: nowrap; }
.proc-nums strong { white-space: nowrap; }
.port-tag { font-size: 10px; color: #94a3b8; background: #f1f5f9; border-radius: 4px; padding: 1px 4px; margin-left: 6px; vertical-align: 1px; }
.proc-list, .port-list, .audit-list { grid-template-columns: minmax(0, 1fr); }
.proc-row, .port-row, .audit-row { min-width: 0; }

/* 站点批量选择 */
.sites-head-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.sites-head-actions .btn { margin-top: 0; width: auto; }
.site-card { position: relative; }
.sites-grid.selecting .site-card { padding-left: 40px; }
.site-check { display: none; position: absolute; left: 12px; top: 14px; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #c3cddd; background: #fff; color: transparent; font-size: 0; align-items: center; justify-content: center; line-height: 1; }
.site-card.selected .site-check::after { content: ''; width: 5px; height: 9px; border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg); margin-top: -2px; }
.sites-grid.selecting .site-check { display: flex; }
.site-card.selected { border-color: #2563eb; background: #eff6ff; }
.site-card.selected .site-check { background: #2563eb; border-color: #2563eb; color: #fff; }
.batch-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: #fff; border-top: 1px solid var(--line); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(15, 23, 42, .08); }
.batch-top { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.batch-top strong { color: var(--ink); font-size: 14px; }
.batch-link { margin-left: auto; border: 0; background: none; color: #2563eb; font-size: 12px; padding: 0; }
.batch-link + .batch-link { margin-left: 12px; }
.batch-actions { display: flex; gap: 8px; }
.batch-actions .btn { flex: 1; margin-top: 0; text-align: center; }
.batch-bar { display: block; }
.batch-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.batch-head #batchCount { margin-right: 0; }
.batch-ops { display: flex; gap: 6px; }
.batch-ops .tool-btn { flex: 1; min-width: 0; padding-left: 4px; padding-right: 4px; }

/* 计划任务 */
.cron-panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-top: 12px; overflow: hidden; }
.cron-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px; }
.cron-title { font-size: 14px; font-weight: 700; }
.cron-sub2 { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cron-form { padding: 12px 14px 14px; border-top: 1px solid #f1f5f9; background: #f8fafc; }
.cron-field { display: block; }
.cron-field + .cron-field { margin-top: 10px; }
.cron-field span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.cron-field input { width: 100%; box-sizing: border-box; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; font-family: ui-monospace, Menlo, monospace; background: #fff; }
.cron-form-hint { font-size: 11px; color: var(--muted); margin: 8px 0 0; }
.cron-form-actions { display: flex; gap: 8px; margin-top: 10px; }
.cron-form-actions .btn { flex: 1; margin-top: 0; text-align: center; }
.cron-list { display: grid; }
.cron-row { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid #f1f5f9; align-items: flex-start; }
.cron-row.is-off { opacity: .55; }
.cron-main { flex: 1; min-width: 0; }
.cron-sched { display: flex; align-items: center; gap: 6px; }
.cron-sched code { font-size: 12px; background: #eff6ff; color: #1d4ed8; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.cron-tag { font-size: 10px; color: #a16207; background: #fef9c3; padding: 2px 5px; border-radius: 4px; }
.cron-cmd { font-size: 12px; color: #334155; margin-top: 4px; word-break: break-all; line-height: 1.45; }
.cron-row-actions { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.cron-act { display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 10px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 11px; line-height: 1; color: #334155; }
.cron-act.danger { color: #b91c1c; border-color: #fecaca; }
.cron-section { padding: 0; }
.cron-section-title { padding: 12px 14px 6px; font-size: 12px; font-weight: 700; color: #334155; }
.cron-timers { margin: 0; padding: 0 14px 10px; font-size: 10px; line-height: 1.6; color: #475569; overflow-x: auto; white-space: pre; }
.cron-section-note { padding: 0 14px 12px; font-size: 10.5px; color: var(--muted); }
.cron-drop { display: flex; justify-content: space-between; padding: 9px 14px; border-top: 1px solid #f1f5f9; font-size: 12px; }
.cron-drop-meta { color: var(--muted); font-size: 11px; }
.timer-list { display: grid; }
.timer-row { display: flex; align-items: baseline; gap: 8px; padding: 8px 14px; border-top: 1px solid #f1f5f9; }
.timer-unit { flex: 1; min-width: 0; font-size: 12px; color: #334155; word-break: break-all; }
.timer-meta { flex: 0 0 auto; font-size: 10.5px; color: var(--muted); text-align: right; }

/* 顶栏账户菜单 */
.user-wrap { position: relative; flex: 0 0 auto; }
.user-btn {
  width: 38px; height: 38px; padding: 2px; border: 0; background: none;
  border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.user-btn img { width: 34px; height: 34px; border-radius: 50%; display: block; box-shadow: 0 2px 6px rgba(15, 23, 42, .18); }
.user-btn:active { transform: scale(.94); }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 232px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .16); padding: 6px; z-index: 70;
}
.user-menu[hidden] { display: none; }
.um-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 8px; }
.um-avatar { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 44px; }
.um-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.um-id strong { font-size: 14px; color: var(--ink); }
.um-id span { font-size: 11px; color: var(--muted); }
.um-meta { display: flex; gap: 8px; padding: 0 10px 8px; }
.um-meta > div { flex: 1; background: #f8fafc; border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.um-meta span { font-size: 10px; color: var(--muted); }
.um-meta b { font-size: 12px; color: var(--ink); }
.um-online { color: #047857 !important; }
.um-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.um-item {
  display: flex; align-items: center; justify-content: center; width: 100%;
  padding: 10px; border: 0; background: none; border-radius: 9px;
  font-size: 13px; color: var(--ink); text-decoration: none; cursor: pointer;
  font-family: inherit; text-align: center; line-height: 1.2;
}
.um-item:hover { background: #f1f5f9; }
.um-danger { color: #b91c1c; }
.um-danger:hover { background: #fef2f2; }

/* 概览 v2 */
.ov-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 2px 2px 14px; }
.ov-eyebrow { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ov-hero-title { font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.ov-hero-meta { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.55; }

.ov-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.ov-kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 12px 11px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); min-width: 0; }
.ov-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ov-kpi-head span { font-size: 11.5px; color: var(--muted); }
.ov-kpi-head b { font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ov-iface { font-size: 10.5px !important; color: var(--muted) !important; font-weight: 500; }
.ov-donut-wrap { position: relative; width: 82px; height: 82px; margin: 8px auto 6px; }
.ov-donut { width: 100%; height: 100%; display: block; }
.ov-donut-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 1px; }
.ov-donut-num strong { font-size: 21px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ov-donut-num span { font-size: 10px; color: var(--muted); margin-top: 6px; }
.ov-kpi-foot { font-size: 10px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

.ov-net { display: flex; flex-direction: column; gap: 7px; padding: 14px 0 12px; }
.ov-net-row { display: flex; align-items: center; gap: 6px; }
.ov-net-arrow { width: 20px; height: 20px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; flex: 0 0 20px; }
.ov-net-arrow.down { background: #e8f7f1; color: #0f9d6e; }
.ov-net-arrow.up { background: #eef2ff; color: #4c7df6; }
.ov-net-row strong { font-size: 12px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ov-net-row em { font-style: normal; font-size: 9.5px; color: var(--muted); margin-left: auto; }

.ov-panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 13px 13px 11px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.ov-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ov-panel-head h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.ov-panel-head span { font-size: 10.5px; color: var(--muted); }

.ov-spark { width: 100%; height: 74px; display: block; }
.ov-spark-foot { display: flex; justify-content: space-between; gap: 6px; font-size: 10px; color: var(--muted); padding: 4px 2px 2px; flex-wrap: wrap; }
.ov-spark-foot b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.ov-stack { display: flex; height: 9px; border-radius: 99px; overflow: hidden; background: #eef2f8; gap: 2px; }
.ov-stack span { display: block; height: 100%; }
.ov-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 9px 0 2px; font-size: 10.5px; color: var(--muted); }
.ov-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ov-legend i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }

.ov-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 4px -4px 0; padding: 0 4px; }
.ov-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ov-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 10px; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ov-table td { padding: 8px; border-bottom: 1px solid #f2f5fa; color: var(--ink); white-space: nowrap; }
.ov-table tbody tr:last-child td { border-bottom: 0; }
.ov-table tbody tr:hover td { background: #fafcff; }
.ov-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ov-dom { max-width: 118px; overflow: hidden; text-overflow: ellipsis; }
.ov-dom a { color: var(--ink); text-decoration: none; }
.ov-muted { color: var(--muted); }

.ov-pill { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 99px; font-size: 10px; font-weight: 500; }
.ov-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.ov-pill.running, .ov-pill.ssl { background: #e8f7f1; color: #0f9d6e; }
.ov-pill.paused { background: #fef6e3; color: #b45309; }
.ov-pill.pending { background: #f3ecff; color: #7c3aed; }
.ov-pill.error, .ov-pill.failed { background: #fdecec; color: #c2410c; }
.ov-pill.stopped { background: #f1f5f9; color: #64748b; }

.ov-mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.ov-mini-stats.tight { grid-template-columns: repeat(4, 1fr); margin: 2px 0 10px; }
.ov-mini-stats > div { background: #f8fafc; border-radius: 9px; padding: 7px 4px; text-align: center; min-width: 0; }
.ov-mini-stats strong { display: block; font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ov-mini-stats span { font-size: 9.5px; color: var(--muted); }

.ov-kv { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ov-kv th { text-align: left; font-weight: 400; color: var(--muted); padding: 6px 8px 6px 0; width: 72px; vertical-align: top; white-space: nowrap; }
.ov-kv td { padding: 6px 0; color: var(--ink); word-break: break-all; }
.ov-kv tr + tr th, .ov-kv tr + tr td { border-top: 1px solid #f4f7fb; }

.ov-duo { display: grid; gap: 12px; }
.ov-empty { font-size: 12px; color: var(--muted); padding: 18px 0; text-align: center; }
.ov-empty a { color: #4c7df6; }

@media (min-width: 720px) {
  .ov-kpis { grid-template-columns: repeat(4, 1fr); }
  .ov-duo { grid-template-columns: 1fr 1fr; }
  .ov-hero-title { font-size: 23px; }
  .ov-donut-wrap { width: 92px; height: 92px; }
}
.ov-kpis { grid-auto-rows: 1fr; }
.ov-issues { margin-bottom: 12px; }
.ov-pill.off { background: #f1f5f9; color: #94a3b8; }
.ov-net-row em { margin-left: 4px; }
.ov-badge { font-size: 11.5px; padding: 4px 9px; }
.ov-spark { height: 64px; }
.ov-net { padding: 12px 0 10px; gap: 10px; }
.ov-net-row strong { font-size: 12.5px; }

/* 面板域名绑定 */
.pd-card { border-color: #dbe6f7; }
.pd-badge { font-size: 11px; padding: 3px 9px; border-radius: 99px; background: #f1f5f9; color: #94a3b8; white-space: nowrap; }
.pd-badge.on { background: #e8f7f1; color: #0f9d6e; }
.pd-now { background: #f8fbff; border: 1px solid #e6eefb; border-radius: 11px; padding: 11px 12px; margin: 10px 0 14px; }
.pd-domain { font-size: 15px; font-weight: 600; color: var(--ink); word-break: break-all; }
.pd-now .hint { margin-top: 4px; }
.pd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pd-actions form { margin: 0; }
.pd-actions .btn.danger { background: #fff; border-color: #fecaca; color: #b91c1c; }
.pd-check { display: flex; gap: 9px; align-items: flex-start; margin: 12px 0 2px; font-size: 12.5px; color: #374151; line-height: 1.45; }
.pd-check input { width: 16px; height: 16px; margin: 1px 0 0; flex: 0 0 16px; }
.pd-check em { display: block; font-style: normal; font-size: 11px; color: var(--muted); margin-top: 2px; }
.pd-form .form-actions { margin-top: 14px; }
.pd-note { display: flex; gap: 6px; align-items: flex-start; }
.pd-note::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #10b981; margin-top: 6px; flex: 0 0 6px; }
.pd-note.strict::before { background: #f59e0b; }
.pd-actions .btn { background: #f4f8ff; border-color: #cfe0fb; color: #2563eb; }
.pd-actions .btn.danger { background: #fff; border-color: #fecaca; color: #b91c1c; }
.pd-actions { margin-top: 12px; }
.pd-note::before { background: #94a3b8; }
.pd-actions .btn { background: #fff; border-color: #bfdbfe; color: #2563eb; }

/* ========== 统一控件层（消除原生外观） ========== */
:root {
  --ctl-h: 40px;
  --ctl-border: #dbe2ec;
  --ctl-focus: #2563eb;
}

input, select, textarea, button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
button { appearance: none; -webkit-appearance: none; }
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

input:not([type]), input[type="text"], input[type="password"], input[type="email"], input[type="url"],
input[type="search"], input[type="tel"], input[type="number"], input[type="date"],
input[type="time"], select, textarea {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: var(--ctl-h);
  padding: 9px 12px;
  border: 1px solid var(--ctl-border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 1px 1px rgba(15, 23, 42, .02);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 88px; resize: none; line-height: 1.6; }
select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
input:not([type]):hover, input[type="text"]:hover, input[type="password"]:hover, input[type="email"]:hover,
input[type="url"]:hover, input[type="search"]:hover, input[type="tel"]:hover,
input[type="number"]:hover, select:hover, textarea:hover { border-color: #c3cddd; }
input:not([type]):focus, input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus,
input[type="url"]:focus, input[type="search"]:focus, input[type="tel"]:focus,
input[type="number"]:focus, input[type="date"]:focus, input[type="time"]:focus,
select:focus, textarea:focus {
  outline: none;
  border-color: var(--ctl-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
input::placeholder, textarea::placeholder { color: #9aa7ba; }
input:disabled, select:disabled, textarea:disabled {
  background: #f6f8fb; color: #94a3b8; cursor: not-allowed; box-shadow: none;
}
input:-webkit-autofill, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px #fff inset, 0 0 0 3px rgba(37, 99, 235, .0);
  transition: background-color 9999s;
}

/* 复选 / 单选 */
input[type="checkbox"], input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  flex: 0 0 18px;
  border: 1.5px solid #c3cddd;
  border-radius: 5px;
  background: #fff;
  position: relative;
  cursor: pointer;
  vertical-align: -3px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: #93a6c4; }
input[type="checkbox"]:checked { background: var(--ctl-focus); border-color: var(--ctl-focus); }
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5.5px;
  top: 2px;
  width: 4.5px;
  height: 8.5px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="radio"]:checked { border-color: var(--ctl-focus); border-width: 5px; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}

/* 文件选择 */
input[type="file"] {
  font-size: 12px;
  color: var(--muted);
  max-width: 100%;
}
input[type="file"]::file-selector-button {
  appearance: none;
  -webkit-appearance: none;
  margin-right: 10px;
  padding: 7px 12px;
  border: 1px solid var(--ctl-border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
input[type="file"]::file-selector-button:hover { background: #eef2f8; border-color: #c3cddd; }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: #d3dbe7 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d3dbe7;
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #b8c4d6; background-clip: content-box; }

::selection { background: rgba(37, 99, 235, .18); color: inherit; }

/* 统一焦点环 */
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid rgba(37, 99, 235, .45);
  outline-offset: 2px;
}

/* 自绘确认弹窗 */
.ui-confirm {
  position: fixed; inset: 0; z-index: 180; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(15, 23, 42, .5); opacity: 0; transition: opacity .18s ease;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.ui-confirm.show { opacity: 1; }
.uc-card {
  width: 100%; max-width: 340px; background: #fff; border-radius: 18px;
  padding: 22px 20px 18px; box-shadow: 0 24px 70px rgba(2, 6, 23, .32);
  transform: translateY(10px) scale(.97); transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}
.ui-confirm.show .uc-card { transform: none; }
.uc-icon {
  width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; margin-bottom: 14px;
  background: #eff6ff; color: #2563eb;
}
.uc-icon.danger { background: #fef2f2; color: #dc2626; }
.uc-title { font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.4; margin-bottom: 6px; }
.uc-msg { font-size: 13px; color: #5b6879; line-height: 1.65; word-break: break-word; }
.uc-actions { display: flex; gap: 9px; margin-top: 20px; }
.uc-actions .btn { flex: 1; margin: 0; width: auto; height: 42px; }
.uc-actions .btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.uc-actions .btn.danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* 开关行（布尔设置统一使用） */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; }
.switch-row .sw-text { font-size: 12.5px; color: #374151; line-height: 1.45; }
.switch-row .sw-text em { display: block; font-style: normal; font-size: 11px; color: var(--muted); margin-top: 2px; }
.switch-row .switch { flex: 0 0 auto; }

.uc-icon svg { display: block; }
.uc-actions .btn { border-radius: 12px; }

/* 危险按钮统一 */
.btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.danger:disabled, .btn.danger[disabled] { background: #f1f5f9; border-color: #e2e8f0; color: #a8b3c2; opacity: 1; }

/* ---------- 编辑器语法高亮 ---------- */
.editor-shell { --ed-fs: 13px; --ed-lh: 20px; }
.editor-code { position: relative; flex: 1; min-width: 0; display: flex; overflow: hidden; }
.hl-layer {
  position: absolute; inset: 0; margin: 0; padding: 12px; border: 0; overflow: hidden;
  pointer-events: none; background: #fff; white-space: pre; tab-size: 4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--ed-fs); line-height: var(--ed-lh); color: #24292f;
}
.hl-layer code { display: block; font: inherit; background: none; padding: 0; white-space: pre; color: inherit; }
.editor-code .code-editor {
  position: relative; z-index: 2; flex: 1; width: 100%; height: 100%; min-height: 0;
  padding: 12px; border: 0; border-radius: 0; background: transparent;
  color: transparent; caret-color: #1f2937; resize: none; overflow: auto; white-space: pre; tab-size: 4;
  font-size: var(--ed-fs); line-height: var(--ed-lh);
}
.editor-code .code-editor::selection { background: rgba(37, 99, 235, .2); color: transparent; }
.editor-shell .line-numbers { line-height: var(--ed-lh); }
@media (max-width: 820px) {
  .editor-shell { --ed-fs: 14px; --ed-lh: 22px; }
}

/* 高亮配色（GitHub 亮色） */
.hljs-comment, .hljs-quote { color: #8b949e; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type, .hljs-doctag { color: #cf222e; }
.hljs-string, .hljs-template-tag, .hljs-regexp { color: #0a3069; }
.hljs-attr, .hljs-attribute, .hljs-property { color: #6f42c1; }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-link { color: #953800; }
.hljs-title, .hljs-section, .hljs-title.function_, .hljs-title.class_ { color: #8250df; }
.hljs-variable, .hljs-template-variable, .hljs-params { color: #953800; }
.hljs-built_in, .hljs-class .hljs-title { color: #0550ae; }
.hljs-meta, .hljs-meta .hljs-keyword { color: #57606a; }
.hljs-tag, .hljs-name, .hljs-selector-id, .hljs-selector-class { color: #116329; }
.hljs-selector-pseudo, .hljs-selector-attr { color: #8250df; }
.hljs-attribute, .hljs-property { color: #0550ae; }
.hljs-subst { color: #24292f; }
.hljs-deletion { background: #ffebe9; color: #82071e; }
.hljs-addition { background: #dafbe1; color: #116329; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

/* 移动端：抑制横向过滚动与页面级橡皮筋（浏览器历史手势本身无法拦截） */
html, body { overscroll-behavior-x: none; }
.code-editor, .hl-layer, .table-wrap { overscroll-behavior-x: contain; }

/* ---------- HTTPS 开关卡片 ---------- */
.ssl-card { position: relative; }
.ssl-card .switch-row { padding: 13px 0; border-top: 1px solid #eef2f7; }
.ssl-card .switch-row:first-of-type { border-top: 0; }
.ssl-card .switch-row.is-disabled { opacity: .55; }
.ssl-hint { margin: 6px 0 2px; }
.ssl-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; padding: 12px; background: #f8fafc; border-radius: 12px; }
.ssl-meta strong { display: block; font-size: 15px; color: #0f172a; font-weight: 600; }
.ssl-meta span { font-size: 12px; color: #8b97a8; }
.ssl-renew { margin-top: 12px; }
.ssl-busy { display: none; position: absolute; inset: 0; z-index: 5; align-items: center; justify-content: center; gap: 10px; border-radius: inherit; background: rgba(255,255,255,.9); backdrop-filter: blur(2px); font-size: 13px; color: #334155; }
.ssl-card.is-busy .ssl-busy { display: flex; }
.spinner { width: 16px; height: 16px; border: 2px solid #cbd5e1; border-top-color: #2563eb; border-radius: 50%; animation: sslspin .8s linear infinite; }
@keyframes sslspin { to { transform: rotate(360deg); } }

/* ---------- 公网 IP 自动识别 ---------- */
.ip-readonly { background: #f6f8fb; color: #334155; }
.ip-warn { margin: 2px 0 0; padding: 10px 12px; border-radius: 10px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: 12.5px; line-height: 1.55; }
.ip-warn strong { display: block; color: #c2410c; margin-bottom: 2px; font-weight: 600; }

/* ---------- 网络实时刷新 ---------- */
#netLive.net-tick strong { animation: netPulse .45s ease; }
@keyframes netPulse { 0% { opacity: .35; } 100% { opacity: 1; } }

/* 待处理项允许两行，避免提示被截断 */
.ov-issue { align-items: flex-start; }
.ov-issue-dot { margin-top: 6px; }
.ov-issue-text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.45; }
#netLive strong { font-variant-numeric: tabular-nums; min-width: 5.5em; display: inline-block; }

/* 网络卡片：60s 双线趋势 + 坐标轴 */
.ov-net-card .ov-net { flex-direction: row; justify-content: space-between; gap: 8px; padding: 9px 0 2px; }
.ov-net-card .ov-net-row { gap: 4px; }
.ov-net-card .ov-net-arrow { width: 16px; height: 16px; flex: 0 0 16px; font-size: 10px; border-radius: 5px; }
.ov-net-card .ov-net-row strong { font-size: 11.5px; }
.nc-chart { position: relative; height: 64px; margin: 3px 0 1px; padding: 0 0 11px 25px; }
.nc-svg { width: 100%; height: 100%; display: block; }
.nc-grid { stroke: #eef2f7; stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.nc-line { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.nc-line.rx { stroke: #0f9d6e; }
.nc-line.tx { stroke: #4c7df6; }
.nc-y, .nc-x { position: absolute; font-size: 8.5px; color: #94a3b8; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nc-y-top { left: 0; top: 0; }
.nc-y-bot { left: 0; bottom: 11px; }
.nc-x-l { left: 25px; bottom: 0; }
.nc-x-r { right: 0; bottom: 0; }

/* 网络卡片高度收敛，与圆环卡对齐 */
.ov-net-card { display: flex; flex-direction: column; }
.ov-net-card .ov-net { padding: 7px 0 0; }
.ov-net-card .ov-kpi-foot { margin-top: auto; padding-top: 2px; }
.nc-chart { height: 54px; margin: 3px 0 0; padding: 0 0 10px 24px; }
.nc-y-bot { bottom: 10px; }
.nc-x-l { bottom: 0; }
.nc-chart { padding-left: 30px; }
.nc-x-l { left: 30px; }
.nc-grid { stroke: #e6ecf5; stroke-dasharray: 2 3; }
.nc-y, .nc-x { font-size: 8px; }

/* 网络卡片：数值竖排到右上角，图表撑满剩余高度 */
.ov-net-head { align-items: flex-start; }
.ov-net-vals { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; margin-top: -1px; }
.ov-net-v { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ov-net-v strong { font-size: 11.5px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.2; }
.ov-net-v i { font-style: normal; font-size: 9px; line-height: 1; width: 13px; height: 13px; border-radius: 4px; display: flex; align-items: center; justify-content: center; flex: 0 0 13px; }
.ov-net-v i.down { background: #e8f7f1; color: #0f9d6e; }
.ov-net-v i.up { background: #eef2ff; color: #4c7df6; }
.ov-net-card .nc-chart { flex: 1 1 auto; height: auto; min-height: 58px; margin-top: 6px; }
.nc-chart { border-radius: 7px; background: linear-gradient(180deg, rgba(15, 157, 110, .035), rgba(76, 125, 246, .055)); }
.nc-area { stroke: none; }
.nc-area.rx { fill: rgba(15, 157, 110, .13); }
.nc-area.tx { fill: rgba(76, 125, 246, .13); }

/* ---------- 文件详细信息 ---------- */
.note-flag { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #f59e0b; margin-left: 6px; vertical-align: 1px; }
.info-card { width: min(92vw, 420px); max-height: 84vh; overflow-y: auto; }
.info-sub { margin-bottom: 0; word-break: break-all; }
.info-list { margin: 9px 0 4px; border-top: 1px solid #eef2f7; }
.info-row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid #f4f7fb; font-size: 12.5px; align-items: flex-start; }
.info-row > span { color: #8b97a8; flex: 0 0 60px; font-size: 12px; line-height: 1.5; }
.info-row > b { color: #1f2937; font-weight: 500; word-break: break-all; text-align: right; flex: 1; line-height: 1.5; font-variant-numeric: tabular-nums; }
.info-note { margin-top: 12px; }
.info-note label { display: block; font-size: 12px; color: #64748b; margin-bottom: 6px; }
.info-note textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px; max-height: 150px; padding: 9px 11px; border: 1px solid #dbe2ec; border-radius: 10px; font: inherit; font-size: 13px; line-height: 1.5; color: #1f2937; background: #fff; }
.info-note textarea:focus { outline: none; border-color: #93b4f6; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

/* 长字段（路径 / MD5 / 链接目标）整行展示，避免断成两行 */
.info-row--wide { flex-direction: column; gap: 5px; }
.info-row--wide > span { flex: none; }
.info-row--wide > b { flex: none; width: 100%; text-align: left; display: flex; align-items: center; gap: 8px; }
.info-row--wide code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; line-height: 1.5; word-break: break-all; letter-spacing: .1px; color: #1f2937; }
.info-copy { flex: 0 0 auto; border: 1px solid #dbe2ec; background: #fff; color: #475569; font-size: 10.5px; line-height: 1; padding: 4px 7px; border-radius: 6px; cursor: pointer; }
.info-copy:hover { border-color: #93b4f6; color: #2563eb; }
.info-copy:active { background: #f1f5fb; }
